update download student endpoint for coordinator view - fix mode filtering students
This commit is contained in:
parent
7a90c84178
commit
8f8deb4238
@ -128,8 +128,9 @@ def upload_students(file: dict) -> dict:
|
||||
@bp.route("/download/", methods=["POST"])
|
||||
@bp.input(StudentListFileDownloaderSchema, location='query')
|
||||
def download_students(query: dict) -> Response:
|
||||
mode = query.get('mode') or True
|
||||
students = db.session.query(Student).join(Group).\
|
||||
mode = query.get('mode')
|
||||
mode = mode if mode is not None else True
|
||||
students = db.session.query(Student).join(Group). \
|
||||
join(ProjectSupervisor).filter(Student.mode == mode).all()
|
||||
|
||||
if len(students) == 0:
|
||||
@ -137,5 +138,4 @@ def download_students(query: dict) -> Response:
|
||||
csv_file = generate_csv(students)
|
||||
response = Response(csv_file, mimetype='text/csv')
|
||||
response.headers.set("Content-Disposition", "attachment", filename="students_list.csv")
|
||||
print(get_debug_queries())
|
||||
return response
|
||||
|
Loading…
Reference in New Issue
Block a user