Commit 4f41349076dfb0ebafe467574990fa258fc25b0c

Authored by Miguel Barão
1 parent a0a8b360
Exists in master and in 1 other branch dev

- minor

Showing 1 changed file with 5 additions and 5 deletions   Show diff stats
@@ -6,7 +6,7 @@ import bcrypt @@ -6,7 +6,7 @@ import bcrypt
6 from sqlalchemy import create_engine 6 from sqlalchemy import create_engine
7 from sqlalchemy.orm import sessionmaker, scoped_session 7 from sqlalchemy.orm import sessionmaker, scoped_session
8 from models import Base, Student, Test, Question 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 import test 11 import test
12 import threading 12 import threading
@@ -23,7 +23,7 @@ class App(object): @@ -23,7 +23,7 @@ class App(object):
23 # uid1: { 23 # uid1: {
24 # 'student': {'number': 123, 'name': john, ...}, 24 # 'student': {'number': 123, 'name': john, ...},
25 # 'test': {...} 25 # 'test': {...}
26 - # } 26 + # },
27 # uid2: {...} 27 # uid2: {...}
28 # } 28 # }
29 logger.info('============= Running perguntations =============') 29 logger.info('============= Running perguntations =============')
@@ -54,7 +54,7 @@ class App(object): @@ -54,7 +54,7 @@ class App(object):
54 54
55 # ----------------------------------------------------------------------- 55 # -----------------------------------------------------------------------
56 # helper to manage db sessions using the `with` statement, for example 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 @contextmanager 58 @contextmanager
59 def db_session(self): 59 def db_session(self):
60 try: 60 try:
@@ -113,7 +113,7 @@ class App(object): @@ -113,7 +113,7 @@ class App(object):
113 return False 113 return False
114 else: 114 else:
115 logger.info('Student {}: logged out.'.format(uid)) 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 return True 117 return True
118 118
119 # ----------------------------------------------------------------------- 119 # -----------------------------------------------------------------------
@@ -121,7 +121,7 @@ class App(object): @@ -121,7 +121,7 @@ class App(object):
121 if uid in self.online: 121 if uid in self.online:
122 logger.info('Student {}: generating new test.'.format(uid)) 122 logger.info('Student {}: generating new test.'.format(uid))
123 student_id = self.online[uid]['student'] 123 student_id = self.online[uid]['student']
124 - self.lock.acquire() # FIXME is it needed? 124 + self.lock.acquire()
125 self.online[uid]['test'] = self.testfactory.generate(student_id) 125 self.online[uid]['test'] = self.testfactory.generate(student_id)
126 self.lock.release() 126 self.lock.release()
127 return self.online[uid]['test'] 127 return self.online[uid]['test']