mirror of
https://github.com/jakobkordez/s5_practice.git
synced 2025-05-15 16:20:31 +00:00
Fix categories
This commit is contained in:
parent
c746cf69f4
commit
85228985d4
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -213,7 +213,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -255,39 +255,39 @@
|
|||||||
" {'id': 35, 'title': 'Meritve', 'questions': [(909, 970)]},\n",
|
" {'id': 35, 'title': 'Meritve', 'questions': [(909, 970)]},\n",
|
||||||
"]\n",
|
"]\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",
|
" q = json.load(file)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"if type(q) is not list:\n",
|
"if type(q) is not list:\n",
|
||||||
" q = q['questions']\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",
|
"\n",
|
||||||
"q = {'categories': categories, 'questions': q}\n",
|
"q = {'categories': categories, 'questions': q}\n",
|
||||||
"\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)"
|
" json.dump(q, file, ensure_ascii=False, indent=2)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"with open('../assets/questions.json', encoding='utf-8') as file:\n",
|
"with open('../assets/questions.json', encoding='utf-8') as file:\n",
|
||||||
" q = json.load(file)\n",
|
" q = json.load(file)\n",
|
||||||
@ -318,11 +318,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"interpreter": {
|
|
||||||
"hash": "11938c6bc6919ae2720b4d5011047913343b08a43b18698fd82dedb0d4417594"
|
|
||||||
},
|
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.9.7 64-bit",
|
"display_name": "Python 3",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@ -336,9 +333,14 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.5"
|
"version": "3.11.1"
|
||||||
},
|
},
|
||||||
"orig_nbformat": 4
|
"orig_nbformat": 4,
|
||||||
|
"vscode": {
|
||||||
|
"interpreter": {
|
||||||
|
"hash": "5238573367df39f7286bb46f9ff5f08f63a01a80960060ce41e3c79b190280fa"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 2
|
"nbformat_minor": 2
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$primary: #29c0f7;
|
$primary: #03a9f4;
|
||||||
$container-max-width: 1200px;
|
$container-max-width: 1200px;
|
||||||
|
|
||||||
$section-padding: 2rem 1.5rem;
|
$section-padding: 2rem 1.5rem;
|
||||||
|
@ -26,8 +26,7 @@ export const getQuestions = async (): Promise<Question[]> => {
|
|||||||
image: question.image,
|
image: question.image,
|
||||||
answers: question.answers,
|
answers: question.answers,
|
||||||
correct: question.correct,
|
correct: question.correct,
|
||||||
// TODO
|
category: question.category,
|
||||||
category: 0,
|
|
||||||
}))
|
}))
|
||||||
.filter((question: Question) => question.correct != null);
|
.filter((question: Question) => question.correct != null);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user