diff --git a/course.py b/course.py index 7cdf432..f79fd43 100644 --- a/course.py +++ b/course.py @@ -142,10 +142,8 @@ def course_info(course_id, year): all_years = db.session.query(Course).filter_by(id=course.id).distinct(Course.year).order_by( Course.year.desc()).all() - evaluations = db.session.query(Evaluation).filter( - Evaluation.course_id == course_id, - Evaluation.course_year < course.year - ).all() + evaluations = db.session.query(Evaluation).filter(Evaluation.course_id == course_id).order_by( + Evaluation.course_year.desc()).all() return render_template('course_info.html', course=course, all_years=all_years, current_year=year, evaluations=evaluations) @@ -267,33 +265,13 @@ def add_duplicate_course(): return redirect(url_for('course.course_info', course_id=course_id, year=year)) -''' -@course_bp.route('/evaluations//') -@login_required -def evaluations(user_id, current_year): - courses = db.session.query(Course).filter_by(year=current_year).all() - - return render_template('evaluations.html', courses=courses, current_year=current_year, user_id=user_id) - - -@course_bp.route('/evaluation/') -@login_required -def evaluation(evaluation_id): - evaluation = db.session.query(Evaluation).get(evaluation_id) - if not evaluation: - return flash("Evaluation not found", "danger") - - return render_template('evaluations.html', evaluation=evaluation, current_year=evaluation.course_year) -''' - @course_bp.route('/evaluations//', defaults={'evaluation_id': None}) @course_bp.route('/evaluation/', defaults={'user_id': None, 'current_year': None}) @login_required def evaluations(user_id=None, current_year=None, evaluation_id=None): - evaluation = db.session.query(Evaluation).get(evaluation_id) \ - if evaluation_id else None + if evaluation_id else None year = evaluation.course_year if evaluation else current_year courses = db.session.query(Course).filter_by(year=year).all() if evaluation: @@ -307,7 +285,7 @@ def evaluations(user_id=None, current_year=None, evaluation_id=None): @course_bp.route('/create_evaluations//', methods=['POST']) @login_required -#@check_access_level(Role.RESEARCHER) +# @check_access_level(Role.RESEARCHER) def create_evaluation(user_id, current_year): form = request.form if not form: @@ -334,7 +312,7 @@ def create_evaluation(user_id, current_year): flash('Evaluation created successfully!', 'success') new_evaluation = Evaluation(course_id=course_id, course_year=current_year, user_id=user_id, task=tasks, - other_task=other_task ,nbr_hours=evaluation_hour, workload=workload, + other_task=other_task, nbr_hours=evaluation_hour, workload=workload, comment=comment) db.session.add(new_evaluation) db.session.commit() diff --git a/templates/course_info.html b/templates/course_info.html index 3e7eae2..05a5151 100644 --- a/templates/course_info.html +++ b/templates/course_info.html @@ -49,14 +49,14 @@

History


-