Commit 6a603afc5d3197547fa3a7985502c4caece436fe

Authored by Miguel Barão
1 parent 9b8820e4
Exists in dev

fix a pyright error on sqlalchemy query variables

Showing 1 changed file with 6 additions and 4 deletions   Show diff stats
aprendizations/learnapp.py
@@ -159,8 +159,8 @@ class Application(): @@ -159,8 +159,8 @@ class Application():
159 await asyncio.sleep(random()) 159 await asyncio.sleep(random())
160 160
161 with Session(self._engine) as session: 161 with Session(self._engine) as session:
162 - query = select(Student).where(Student.id == uid)  
163 - student = session.execute(query).scalar_one_or_none() 162 + query_student = select(Student).where(Student.id == uid)
  163 + student = session.execute(query_student).scalar_one_or_none()
164 if student is None: 164 if student is None:
165 logger.info('User "%s" does not exist', uid) 165 logger.info('User "%s" does not exist', uid)
166 return False 166 return False
@@ -179,8 +179,10 @@ class Application(): @@ -179,8 +179,10 @@ class Application():
179 179
180 # get topics for this student and set its current state 180 # get topics for this student and set its current state
181 with Session(self._engine) as session: 181 with Session(self._engine) as session:
182 - query = select(StudentTopic).where(StudentTopic.student_id == uid)  
183 - student_topics = session.execute(query).scalars().all() 182 + query_student_topics = select(StudentTopic) \
  183 + .where(StudentTopic.student_id == uid)
  184 + student_topics = session.execute(query_student_topics) \
  185 + .scalars().all()
184 186
185 state = {t.topic_id: { 187 state = {t.topic_id: {
186 'level': t.level, 188 'level': t.level,