From 63121da4b7ed0bf66504287cea99d44e5810500b Mon Sep 17 00:00:00 2001 From: NetMan <13informatyka14@gmail.com> Date: Sat, 13 Dec 2025 16:07:23 +0100 Subject: [PATCH] postgres -> sqlite, pinia/middleware fix? other smaller: little type fixes, little changes to ui - more readable category chooser - result screen with correct, incorrect and chosen answers little changes to readme --- .env.example | 2 +- README.md | 14 +- app.vue | 6 + categories.ts | 30 +++ components/ResultModal.vue | 6 +- components/bar/right/Result.vue | 11 +- components/question/Advanced.vue | 17 +- components/question/Basic.vue | 23 +- db/database.db | Bin 0 -> 2469888 bytes db/schema.ts | 36 ++++ drizzle.config.ts | 4 +- middleware/exam.ts | 10 +- middleware/result.ts | 8 +- nuxt.config.ts | 6 +- package.json | 4 +- pages/anomaly.vue | 17 ++ pages/exam.vue | 69 +++--- pages/index.vue | 33 +-- pages/result.vue | 107 ++++++---- pnpm-lock.yaml | 354 +++++++++++++++++++++++++++---- server/api/advanced.get.ts | 8 +- server/api/basic.get.ts | 4 +- src/db/schema.ts | 35 --- store/examStore.ts | 101 +++++---- types/index.ts | 11 +- 25 files changed, 654 insertions(+), 262 deletions(-) create mode 100644 db/database.db create mode 100644 db/schema.ts create mode 100644 pages/anomaly.vue delete mode 100644 src/db/schema.ts diff --git a/.env.example b/.env.example index 997c2d1..3678159 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,2 @@ -DATABASE_URL="postgres://USERNAME:PASSWORD@HOST:PORT/DATABASE" +DATABASE_URL="file:./db/database.db" CDN_URL="http://DOMAIN.TLD/FOLDER" \ No newline at end of file diff --git a/README.md b/README.md index 2e864bf..4e36209 100644 --- a/README.md +++ b/README.md @@ -12,27 +12,29 @@ pnpm install The [db-prawo-jazdy](https://git.mandarynki.eu/netman/db-prawo-jazdy) project is designed for this one in mind, so use it in conjunction with this - visit it for more details -You also need the exam media files from the (Ministry of Infrasture)[https://www.gov.pl/web/infrastruktura/prawo-jazdy]. The newest at the moment of me writing this (19th of April 2025) are the (visualisations for questions from the 18th of January of 2024)[https://www.gov.pl/pliki/mi/wizualizacje_do_pytan_18_01_2024.zip] +You also need the exam media files from the (Ministry of Infrasture)[https://www.gov.pl/web/infrastruktura/prawo-jazdy] - the latest files should be there. The newest at the moment of me writing this (13th of Decemver 2025) are the (visualisations for questions from November(?) of 2025)[https://www.gov.pl/pliki/mi/pytania_egzaminacyjne_na_prawo_jazdy_11_2025.zip] # To-do: - [x] re-forge database structure (good for now) - [x] choose category (good for now) - [x] come up with how to show results appropriately -- [x] db: script for processing, share appropriate files - [x] better answer click recognition - [x] beautify website (good for now) -- [ ] fix pinia middleware between pages, MAJOR ISSUE - finishing exam sometimes redirects to homepage instead of results, help appreciated +- [x] Fixed? Needs testing, but should be fine question-mark? - fix pinia middleware between pages, MAJOR ISSUE - finishing exam sometimes redirects to homepage instead of results, help appreciated +- [x] (scrapped - lazy loading) - [ ] exam (& results?) warning leave message on exit and timer end (and definitely on refresh) - [ ] question timers -- [ ] lazy loading -- [ ] i18n - pl, en, de, ua (not all questions are not available in ua, api handle) +- [ ] i18n - pl, en, de, ua (not all questions are available in ua, api handle) + - UI i18n + - db: examstore add language field, api handle languages +- [ ] db: (revise) script for processing, (revise and) share appropriate files ## Some info My intention is, to share access to test exams free of charge - all data is free of charge and is already available as public information, either on the gov website, or by writing to the MI -This project is an SSR website mimicking an official driver's license exam (for different categories) with a seperate CDN for media, connected using an ORM to a postgres DB +This project is a website mimicking an official driver's license exam (for different categories) with a seperate CDN for media, connected using an ORM to a postgres DB ## Development Server diff --git a/app.vue b/app.vue index 2b1be09..4346316 100644 --- a/app.vue +++ b/app.vue @@ -3,3 +3,9 @@ + + diff --git a/categories.ts b/categories.ts index 7a888b7..4127f23 100644 --- a/categories.ts +++ b/categories.ts @@ -12,3 +12,33 @@ export default [ 'D1', 'PT', ]; + +export const opis = [ + 'motocykle bez ograniczeń mocy', + '⭐ samochody osobowe do 3,5 t', + 'pojazdy ciężarowe powyżej 3,5 t', + 'autobusy', + 'ciągniki rolnicze i pojazdy wolnobieżne', + 'motorowery i lekkie czterokołowce', + 'motocykle do 125 cm³ i 11 kW', + 'motocykle do 35 kW', + 'czterokołowce (np. quady)', + 'pojazdy od 3,5 t do 7,5 t', + 'autobusy do 16 pasażerów', + 'tramwaje', +]; + +export const wiek = [ + '(24 lata; lub 20 lat jeśli masz kat. A2 min. 2 lata)', + '(18 lat)', + '(21 lat; lub 18 lat z kwalifikacją wstępną)', + '(24 lata; lub 21 lat z kwalifikacją wstępną)', + '(16 lat)', + '(14 lat)', + '(16 lat)', + '(18 lat)', + '(16 lat)', + '(18 lat)', + '(21 lat; lub 18 lat z kwalifikacją wstępną)', + '(21 lat)', +]; diff --git a/components/ResultModal.vue b/components/ResultModal.vue index 660d559..65e4b7c 100644 --- a/components/ResultModal.vue +++ b/components/ResultModal.vue @@ -4,6 +4,8 @@ const myModal = useTemplateRef('myModal'); onMounted(() => { myModal.value?.showModal(); }); + +defineEmits(['again']); - - diff --git a/components/question/Advanced.vue b/components/question/Advanced.vue index 01021b3..50c8bc0 100644 --- a/components/question/Advanced.vue +++ b/components/question/Advanced.vue @@ -1,6 +1,7 @@ + + diff --git a/pages/exam.vue b/pages/exam.vue index ba93497..b332a9a 100644 --- a/pages/exam.vue +++ b/pages/exam.vue @@ -1,13 +1,28 @@