Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit bcb7968

Browse files
committed
bug fix - dynamic pages broke get_datafile
1 parent 9ab989f commit bcb7968

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

controllers/ajax.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,9 +1036,18 @@ def did_donate():
10361036

10371037

10381038
def get_datafile():
1039-
course = request.vars.course_id
1039+
"""
1040+
course_id - string, the name of the course
1041+
acid - the acid of this datafile
1042+
"""
1043+
course = request.vars.course_id # the course name
1044+
the_course = db(db.courses.course_name == course).select().first()
10401045
acid = request.vars.acid
1041-
file_contents = db((db.source_code.acid == acid) & (db.source_code.course_id == course)).select(db.source_code.main_code).first()
1046+
file_contents = db((db.source_code.acid == acid) &
1047+
((db.source_code.course_id == the_course.base_course) |
1048+
(db.source_code.course_id == course))
1049+
).select(db.source_code.main_code).first()
1050+
10421051
if file_contents:
10431052
file_contents = file_contents.main_code
10441053
else:

0 commit comments

Comments
 (0)