Fix categories

This commit is contained in:
Jakob Kordež 2023-02-24 09:25:25 +01:00
parent c746cf69f4
commit 85228985d4
4 changed files with 1975 additions and 1202 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -213,7 +213,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -255,39 +255,39 @@
" {'id': 35, 'title': 'Meritve', 'questions': [(909, 970)]},\n",
"]\n",
"\n",
"with open('../assets/questions.json', encoding='utf-8') as file:\n",
"with open('../public/questions.json', encoding='utf-8') as file:\n",
" q = json.load(file)\n",
"\n",
"if type(q) is not list:\n",
" q = q['questions']\n",
" for i in range(len(q)):\n",
" id = q[i]['id']\n",
" for c in categories:\n",
" for fr, to in c['questions']:\n",
" if id >= fr and id <= to:\n",
" q[i]['category'] = c['id']\n",
" break\n",
" else:\n",
" continue\n",
" break\n",
"\n",
"categories = [{'id': c['id'], 'title': c['title']} for c in categories]\n",
"\n",
"# Remove \"Risanje\"\n",
"q = list(filter(lambda x: x['category'] != 9, q))\n",
"categories = list(filter(lambda x: x['id'] != 9, categories))\n",
"\n",
"q = {'categories': categories, 'questions': q}\n",
"\n",
"with open('../assets/questions.json', 'w', encoding='utf-8') as file:\n",
"with open('../public/questions.json', 'w', encoding='utf-8') as file:\n",
" json.dump(q, file, ensure_ascii=False, indent=2)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'id': 116, 'question': 'Katere modulacije smemo uporabljati na 30-meterskem pasu?', 'image': None, 'answers': ['CW in fone', 'CW, digimode in fone', 'CW in digimode'], 'correct': 2}\n",
"{'id': 394, 'question': 'Kateri je najpogostejši način, ki ga uporabljajo DX postaje pri svojem delu?', 'image': None, 'answers': ['Najpogosteje se uporablja tako imenovani »simpleks pileup«', 'DX postaje najpogosteje uporabljajo SPLIT način dela. Poslušajo nad (UP) ali pod (DOWN) svojo oddajno frekvenco', 'DX postaje vedno poslušajo in oddajajo na isti frekvenci, saj je možno tako narediti največ zvez v eni minuti'], 'correct': 1}\n",
"{'id': 427, 'question': 'Kako se imenuje enota za merjenje električne upornosti?', 'image': None, 'answers': ['Amper [A]', 'Watt [W]', 'Ohm [Ω]'], 'correct': 2}\n",
"{'id': 491, 'question': 'Izračunaj moč, ki se troši na bremenu z upornostjo 1 ohm, če nanj priključimo napetost 10V.', 'image': None, 'answers': ['100 W', '10 W', '1 W'], 'correct': 0}\n",
"{'id': 642, 'question': 'S prijateljem vzpostavimo zvezo v telegrafiji (CW) in nato v telefoniji (najprej SSB in potem še FM). Kateri od uporabljenih signalov ima NAJVEČJO pasovno širino?', 'image': None, 'answers': ['CW signal', 'SSB signal', 'FM signal'], 'correct': 2}\n",
"{'id': 643, 'question': 'S prijateljem vzpostavimo zvezo v telegrafiji (CW) in nato v telefoniji (najprej SSB in potem še FM). Kateri od uporabljenih signalov ima NAJMANJŠO pasovno širino?', 'image': None, 'answers': ['CW signal', 'SSB signal', 'FM signal'], 'correct': 0}\n",
"---\n",
"---\n",
"970 970\n"
]
}
],
"outputs": [],
"source": [
"with open('../assets/questions.json', encoding='utf-8') as file:\n",
" q = json.load(file)\n",
@ -318,11 +318,8 @@
}
],
"metadata": {
"interpreter": {
"hash": "11938c6bc6919ae2720b4d5011047913343b08a43b18698fd82dedb0d4417594"
},
"kernelspec": {
"display_name": "Python 3.9.7 64-bit",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
@ -336,9 +333,14 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.5"
"version": "3.11.1"
},
"orig_nbformat": 4
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "5238573367df39f7286bb46f9ff5f08f63a01a80960060ce41e3c79b190280fa"
}
}
},
"nbformat": 4,
"nbformat_minor": 2

View File

@ -1,4 +1,4 @@
$primary: #29c0f7;
$primary: #03a9f4;
$container-max-width: 1200px;
$section-padding: 2rem 1.5rem;

View File

@ -26,8 +26,7 @@ export const getQuestions = async (): Promise<Question[]> => {
image: question.image,
answers: question.answers,
correct: question.correct,
// TODO
category: 0,
category: question.category,
}))
.filter((question: Question) => question.correct != null);
};