Commit 4f41349076dfb0ebafe467574990fa258fc25b0c
1 parent
a0a8b360
Exists in
master
and in
1 other branch
- minor
Showing
1 changed file
with
5 additions
and
5 deletions
Show diff stats
app.py
... | ... | @@ -6,7 +6,7 @@ import bcrypt |
6 | 6 | from sqlalchemy import create_engine |
7 | 7 | from sqlalchemy.orm import sessionmaker, scoped_session |
8 | 8 | from models import Base, Student, Test, Question |
9 | -from contextlib import contextmanager # to use `with` statement for db sessions | |
9 | +from contextlib import contextmanager # `with` statement in db sessions | |
10 | 10 | |
11 | 11 | import test |
12 | 12 | import threading |
... | ... | @@ -23,7 +23,7 @@ class App(object): |
23 | 23 | # uid1: { |
24 | 24 | # 'student': {'number': 123, 'name': john, ...}, |
25 | 25 | # 'test': {...} |
26 | - # } | |
26 | + # }, | |
27 | 27 | # uid2: {...} |
28 | 28 | # } |
29 | 29 | logger.info('============= Running perguntations =============') |
... | ... | @@ -54,7 +54,7 @@ class App(object): |
54 | 54 | |
55 | 55 | # ----------------------------------------------------------------------- |
56 | 56 | # helper to manage db sessions using the `with` statement, for example |
57 | - # with self.db_session() as s: ... | |
57 | + # with self.db_session() as s: s.query(...) | |
58 | 58 | @contextmanager |
59 | 59 | def db_session(self): |
60 | 60 | try: |
... | ... | @@ -113,7 +113,7 @@ class App(object): |
113 | 113 | return False |
114 | 114 | else: |
115 | 115 | logger.info('Student {}: logged out.'.format(uid)) |
116 | - del self.online[uid] # FIXME Nao está a gravar o teste como desistencia... | |
116 | + del self.online[uid] | |
117 | 117 | return True |
118 | 118 | |
119 | 119 | # ----------------------------------------------------------------------- |
... | ... | @@ -121,7 +121,7 @@ class App(object): |
121 | 121 | if uid in self.online: |
122 | 122 | logger.info('Student {}: generating new test.'.format(uid)) |
123 | 123 | student_id = self.online[uid]['student'] |
124 | - self.lock.acquire() # FIXME is it needed? | |
124 | + self.lock.acquire() | |
125 | 125 | self.online[uid]['test'] = self.testfactory.generate(student_id) |
126 | 126 | self.lock.release() |
127 | 127 | return self.online[uid]['test'] | ... | ... |