Coverage for app/controllers/admin/minor.py: 33%
18 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-10-02 17:57 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2024-10-02 17:57 +0000
1from flask import render_template, g, abort, request, redirect, url_for
3from app.models.user import User
5from app.controllers.admin import admin_bp
7from app.logic.minor import getMinorInterest, getMinorProgress, toggleMinorInterest
9@admin_bp.route('/admin/cceMinor', methods=['POST','GET'])
10def manageMinor():
12 if not g.current_user.isAdmin:
13 abort(403)
15 if request.method == 'POST':
16 interested_students = request.form.getlist('interestedStudents[]')
18 for i in interested_students:
19 user = User.get(username=i)
20 if not user.minorInterest:
21 toggleMinorInterest(i)
24 interestedStudentsList = getMinorInterest()
25 interestedStudentEmailString = ';'.join([student['email'] for student in interestedStudentsList])
26 sustainedEngagement = getMinorProgress()
29 return render_template('/admin/cceMinor.html',
30 interestedStudentsList = interestedStudentsList,
31 interestedStudentEmailString = interestedStudentEmailString,
32 sustainedEngagement = sustainedEngagement,
33 )