Commit c1422adeaa8ac1dedf3b7dd5da943bf0b33390c7
1 parent
c2ba4715
Exists in
master
and in
1 other branch
maybe fixed sqlalchemy error on studenttopic insertion
Showing
5 changed files
with
12 additions
and
6 deletions
Show diff stats
BUGS.md
1 | 1 | |
2 | 2 | # BUGS |
3 | 3 | |
4 | +- na definicao dos topicos, indicar: | |
5 | + "file: questions.yaml" (default questions.yaml) | |
6 | + "shuffle: True/False" (default False) | |
7 | + "choose: 6" (default tudo) | |
4 | 8 | - SQLAlchemy error (rollback em accao no final de um topico): |
5 | 9 | Users/mjsb/Library/Python/3.7/lib/python/site-packages/sqlalchemy/sql/crud.py:700: SAWarning: Column 'studenttopic.student_id' is marked as a member of the primary key for table 'studenttopic', but has no Python-side or server-side default generator indicated, nor does it indicate 'autoincrement=True' or 'nullable=True', and no explicit value is passed. Primary key columns typically may not store NULL. Note that as of SQLAlchemy 1.1, 'autoincrement=True' must be indicated explicitly for composite (e.g. multicolumn) primary keys if AUTO_INCREMENT/SERIAL/IDENTITY behavior is expected for one of the columns in the primary key. CREATE TABLE statements are impacted by this change as well on most backends. |
6 | 10 | util.warn(msg) | ... | ... |
demo/solar_system/questions.yaml
... | ... | @@ -42,8 +42,8 @@ |
42 | 42 | type: textarea |
43 | 43 | title: Sistema solar |
44 | 44 | text: Escreva o nome dos três planetas mais próximos do Sol. (Exemplo `A, B e C`) |
45 | - # correct: correct-first_3_planets.py | |
46 | - correct: correct-timeout.py | |
45 | + correct: correct-first_3_planets.py | |
46 | + # correct: correct-timeout.py | |
47 | 47 | # opcional |
48 | 48 | answer: Vulcano, Krypton, Plutão |
49 | 49 | lines: 3 | ... | ... |
learnapp.py
... | ... | @@ -170,12 +170,14 @@ class LearnApp(object): |
170 | 170 | a = s.query(StudentTopic).filter_by(student_id=uid, topic_id=topic).one_or_none() |
171 | 171 | if a is None: |
172 | 172 | # insert new studenttopic into database |
173 | + logger.debug('Database insert new studenttopic') | |
173 | 174 | t = s.query(Topic).get(topic) |
174 | - a = StudentTopic(level=level, date=date, topic=t) | |
175 | 175 | u = s.query(Student).get(uid) |
176 | + a = StudentTopic(level=level, date=date, topic=t, student=u) # association object | |
176 | 177 | u.topics.append(a) |
177 | 178 | else: |
178 | 179 | # update studenttopic in database |
180 | + logger.debug('Database update studenttopic') | |
179 | 181 | a.level = level |
180 | 182 | a.date = date |
181 | 183 | ... | ... |
models.py
serve.py
... | ... | @@ -276,11 +276,8 @@ class QuestionHandler(BaseHandler): |
276 | 276 | answer = answer[0] |
277 | 277 | |
278 | 278 | # check answer in another thread (nonblocking) |
279 | - # action = await asyncio.get_event_loop().run_in_executor(None, | |
280 | - # self.learn.check_answer, user, answer) | |
281 | 279 | action = await self.learn.check_answer(user, answer) |
282 | 280 | |
283 | - | |
284 | 281 | # get next question (same, new or None) |
285 | 282 | question = self.learn.get_current_question(user) |
286 | 283 | ... | ... |