vladyslav commited on
Commit
e1fcc9a
·
1 Parent(s): 2550ee1

Some teacher fixes

Browse files
Files changed (2) hide show
  1. app.py +10 -5
  2. constants.py +4 -0
app.py CHANGED
@@ -228,11 +228,16 @@ def update_students(class_name):
228
 
229
 
230
  def handle_student_name_change(student_name):
 
 
 
 
 
231
  print('handle_student_name_change')
232
  if not student_name:
233
  return (
234
  gr.update(choices=[], value=None, visible=False), # book_radio
235
- gr.update(choices=[], value=None, visible=False), # model_radio
236
  gr.update(value=""), # questions_output
237
  gr.update(choices=[], value=None, visible=False), # answer_radio
238
  gr.update(visible=False), # next_button
@@ -248,7 +253,7 @@ def handle_student_name_change(student_name):
248
 
249
  return (
250
  gr.update(choices=list(BOOKS.keys()), value=None, visible=True), # book_radio
251
- gr.update(choices=[], value=None, visible=False), # model_radio
252
  gr.update(value=""), # questions_output
253
  gr.update(choices=[], value=None, visible=False), # answer_radio
254
  gr.update(visible=False), # next_button
@@ -269,7 +274,7 @@ def filter_models(student_name, class_name, book):
269
  print('filter_models')
270
  if not book:
271
  return (
272
- gr.update(choices=[], value=None, visible=False),
273
  gr.update(value=""), # questions_output
274
  gr.update(choices=[], value=None, visible=False), # answer_radio
275
  gr.update(visible=False), # next_button
@@ -285,7 +290,7 @@ def filter_models(student_name, class_name, book):
285
 
286
  if student_name == "Вчитель":
287
  return (
288
- gr.update(choices=MODELS.keys(), value=None, visible=True),
289
  gr.update(value=""), # questions_output
290
  gr.update(choices=[], value=None, visible=False), # answer_radio
291
  gr.update(visible=False), # next_button
@@ -319,7 +324,7 @@ def filter_models(student_name, class_name, book):
319
  available_models = models_list
320
 
321
  return (
322
- gr.update(choices=models_list, value=None, visible=True),
323
  gr.update(value=""), # questions_output
324
  gr.update(choices=[], value=None, visible=False), # answer_radio
325
  gr.update(visible=False), # next_button
 
228
 
229
 
230
  def handle_student_name_change(student_name):
231
+ global available_models
232
+
233
+ if student_name == "Вчитель":
234
+ available_models = list(MODELS.keys())
235
+
236
  print('handle_student_name_change')
237
  if not student_name:
238
  return (
239
  gr.update(choices=[], value=None, visible=False), # book_radio
240
+ gr.update(choices=available_models, value=None, visible=False), # model_radio
241
  gr.update(value=""), # questions_output
242
  gr.update(choices=[], value=None, visible=False), # answer_radio
243
  gr.update(visible=False), # next_button
 
253
 
254
  return (
255
  gr.update(choices=list(BOOKS.keys()), value=None, visible=True), # book_radio
256
+ gr.update(choices=available_models, value=None, visible=False), # model_radio
257
  gr.update(value=""), # questions_output
258
  gr.update(choices=[], value=None, visible=False), # answer_radio
259
  gr.update(visible=False), # next_button
 
274
  print('filter_models')
275
  if not book:
276
  return (
277
+ gr.update(choices=[], value=None, visible=False), # model_radio
278
  gr.update(value=""), # questions_output
279
  gr.update(choices=[], value=None, visible=False), # answer_radio
280
  gr.update(visible=False), # next_button
 
290
 
291
  if student_name == "Вчитель":
292
  return (
293
+ gr.update(choices=MODELS.keys(), value=None, visible=True), # model_radio
294
  gr.update(value=""), # questions_output
295
  gr.update(choices=[], value=None, visible=False), # answer_radio
296
  gr.update(visible=False), # next_button
 
324
  available_models = models_list
325
 
326
  return (
327
+ gr.update(choices=models_list, value=None, visible=True), # model_radio
328
  gr.update(value=""), # questions_output
329
  gr.update(choices=[], value=None, visible=False), # answer_radio
330
  gr.update(visible=False), # next_button
constants.py CHANGED
@@ -31,6 +31,7 @@ CLASSES = ["7-A", "7-B", "7-C", "7-D"]
31
 
32
  STUDENTS = {
33
  "7-A": [
 
34
  "Гайворонський Владислав",
35
  "Гордін Георгій",
36
  "Гуменний Станіслав",
@@ -48,6 +49,7 @@ STUDENTS = {
48
  "Страховецька Софія",
49
  ],
50
  "7-B": [
 
51
  "Авдєєва Аліса",
52
  "Агапов Олександр",
53
  "Горюн Любава",
@@ -65,6 +67,7 @@ STUDENTS = {
65
  "Щербина Герасим",
66
  ],
67
  "7-C": [
 
68
  "Безрук Дар'я",
69
  "Бець Вероніка",
70
  "Головньова Владислава",
@@ -82,6 +85,7 @@ STUDENTS = {
82
  "Шигалевська Марія",
83
  ],
84
  "7-D": [
 
85
  "Капустеринська Аліса",
86
  "Леонідова Мілада",
87
  "Олійник Давід",
 
31
 
32
  STUDENTS = {
33
  "7-A": [
34
+ "Вчитель",
35
  "Гайворонський Владислав",
36
  "Гордін Георгій",
37
  "Гуменний Станіслав",
 
49
  "Страховецька Софія",
50
  ],
51
  "7-B": [
52
+ "Вчитель",
53
  "Авдєєва Аліса",
54
  "Агапов Олександр",
55
  "Горюн Любава",
 
67
  "Щербина Герасим",
68
  ],
69
  "7-C": [
70
+ "Вчитель",
71
  "Безрук Дар'я",
72
  "Бець Вероніка",
73
  "Головньова Владислава",
 
85
  "Шигалевська Марія",
86
  ],
87
  "7-D": [
88
+ "Вчитель",
89
  "Капустеринська Аліса",
90
  "Леонідова Мілада",
91
  "Олійник Давід",