File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44from ..models import (
55 Chapter ,
66 ChapterValidator ,
7+ Courses ,
78 SubChapter ,
89 SubChapterValidator ,
910 Question ,
@@ -137,11 +138,16 @@ async def fetch_page_activity_counts(
137138 page_divids = await session .execute (query )
138139 rslogger .debug (f"PDVD { page_divids } " )
139140 div_counts = {q .name : 0 for q in page_divids .scalars ()}
140- query = select (distinct (Useinfo .div_id )).where (
141- where_clause_common
142- & (Question .name == Useinfo .div_id )
143- & (Useinfo .course_id == course_name )
144- & (Useinfo .sid == username )
141+ query = (
142+ select (distinct (Useinfo .div_id ))
143+ .join (Courses , Courses .course_name == Useinfo .course_id )
144+ .where (
145+ where_clause_common
146+ & (Question .name == Useinfo .div_id )
147+ & (Useinfo .course_id == course_name )
148+ & (Useinfo .sid == username )
149+ & (Useinfo .timestamp > Courses .term_start_date )
150+ )
145151 )
146152 async with async_session () as session :
147153 sid_counts = await session .execute (query )
You can’t perform that action at this time.
0 commit comments