From 4f963ed34b98c68c0bc84317f129db6b40e5554e Mon Sep 17 00:00:00 2001 From: Karina Date: Fri, 6 Sep 2024 09:51:04 -0400 Subject: [PATCH 01/40] Added graduation management to the sidebar, added html, started the route and logic --- app/controllers/admin/graduationManagement.py | 20 +++ app/logic/graduationManagement.py | 15 +++ app/static/js/graduationManagement.js | 0 app/templates/admin/graduationManagement.html | 127 ++++++++++++++++++ app/templates/sidebar.html | 3 + 5 files changed, 165 insertions(+) create mode 100644 app/controllers/admin/graduationManagement.py create mode 100644 app/logic/graduationManagement.py create mode 100644 app/static/js/graduationManagement.js create mode 100644 app/templates/admin/graduationManagement.html diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py new file mode 100644 index 000000000..d19fa031a --- /dev/null +++ b/app/controllers/admin/graduationManagement.py @@ -0,0 +1,20 @@ +from flask import render_template, g, abort, request, redirect, url_for +from app.models.user import User +from app.controllers.admin import admin_bp +from app.logic.graduationManagement import getGradutedStudents + +@admin_bp.route('/admin/graduationManagement', methods=['POST','GET']) +def gradManagement(): + + if not g.current_user.isAdmin: + abort(403) + + graduatedStudents = getGradutedStudents() + + + + return render_template('/admin/graduationManagement.html', + graduatedStudents = graduatedStudents + ) + + diff --git a/app/logic/graduationManagement.py b/app/logic/graduationManagement.py new file mode 100644 index 000000000..28f521555 --- /dev/null +++ b/app/logic/graduationManagement.py @@ -0,0 +1,15 @@ +from collections import defaultdict +from typing import List, Dict +from playhouse.shortcuts import model_to_dict +from peewee import JOIN, fn, Case, DoesNotExist + +from app.models.user import User +from app.models.term import Term + +def getGradutedStudents(): + """ + Get all the users who graduated + """ + graduatedStudents = User.select().where(User.hasGraduated) + + return graduatedStudents \ No newline at end of file diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js new file mode 100644 index 000000000..e69de29bb diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html new file mode 100644 index 000000000..476b697d0 --- /dev/null +++ b/app/templates/admin/graduationManagement.html @@ -0,0 +1,127 @@ +{% set title = "Graduation Management" %} +{% extends "base.html" %} + +{% block scripts %} + {{super()}} + + + {% block styles %} + {{super()}} + + + {% endblock %} +{% endblock %} +{% block app_content %} +

Graduation Management

+ + + + + + + + + + + + {% for student in sustainedEngagement %} + + + + + + + + {% endfor %} + +
NameGraduatedClass Level
+ {{ student.firstName }} {{ student.lastName }} + {% if student.hasGraduated %} + + + +{% endif %} + + {% if student.engagementCount == 4 and student.hasSummer == 'Completed' %} + + {% else %} + + {% endif %} + {{ student.engagementCount }}/4 {{ student.hasSummer }} + {% if student.hasCommunityEngagementRequest %} + {# Placeholder for request other engagement #} + Yes + {% else %} + No + {% endif %} +
+

+
+
+

Interested Students

+
+
+ Add Students + +
+
+ + + + + + + + + {% for student in interestedStudentsList %} + + + + + {% endfor %} + + +
Name Remove Student
+ {{student.firstName}} {{student.lastName}} + + +
+ + + + +{% endblock %} \ No newline at end of file diff --git a/app/templates/sidebar.html b/app/templates/sidebar.html index a1f2f7a37..8c6c1505c 100644 --- a/app/templates/sidebar.html +++ b/app/templates/sidebar.html @@ -75,6 +75,9 @@ Minor Management + + Graduation Management + Reports From e162b331003775d8bbf912ee16ecc686d14609d8 Mon Sep 17 00:00:00 2001 From: Karina Date: Tue, 10 Sep 2024 11:45:59 -0400 Subject: [PATCH 02/40] AModified html and route --- app/controllers/admin/graduationManagement.py | 12 +- app/logic/graduationManagement.py | 2 +- app/templates/admin/graduationManagement.html | 114 ++---------------- 3 files changed, 18 insertions(+), 110 deletions(-) diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index d19fa031a..854a67d23 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -1,20 +1,16 @@ from flask import render_template, g, abort, request, redirect, url_for from app.models.user import User from app.controllers.admin import admin_bp -from app.logic.graduationManagement import getGradutedStudents -@admin_bp.route('/admin/graduationManagement', methods=['POST','GET']) + +@admin_bp.route('/admin/graduationManagement', methods=['GET']) def gradManagement(): if not g.current_user.isAdmin: abort(403) - - graduatedStudents = getGradutedStudents() - + users = User.select(User.username, User.hasGraduated, User.classLevel) - return render_template('/admin/graduationManagement.html', - graduatedStudents = graduatedStudents - ) + return render_template('/admin/graduationManagement.html', users = users) diff --git a/app/logic/graduationManagement.py b/app/logic/graduationManagement.py index 28f521555..b2d360468 100644 --- a/app/logic/graduationManagement.py +++ b/app/logic/graduationManagement.py @@ -6,7 +6,7 @@ from app.models.user import User from app.models.term import Term -def getGradutedStudents(): +def getGraduatedStudents(): """ Get all the users who graduated """ diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 476b697d0..1eb9bdcbd 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -3,6 +3,7 @@ {% block scripts %} {{super()}} + {% block styles %} @@ -11,117 +12,28 @@ {% endblock %} {% endblock %} + {% block app_content %}

Graduation Management

- +

Graduating/Graduated Students

- - - {% for student in sustainedEngagement %} - - - - - - - - {% endfor %} - -
Name Graduated Class Level
- {{ student.firstName }} {{ student.lastName }} - {% if student.hasGraduated %} - - - -{% endif %} - - {% if student.engagementCount == 4 and student.hasSummer == 'Completed' %} - - {% else %} - - {% endif %} - {{ student.engagementCount }}/4 {{ student.hasSummer }} - {% if student.hasCommunityEngagementRequest %} - {# Placeholder for request other engagement #} - Yes - {% else %} - No - {% endif %} -
-

-
-
-

Interested Students

-
-
- Add Students - -
-
- - - - - - - - - {% for student in interestedStudentsList %} - - - - - {% endfor %} - - -
Name Remove Student
- {{student.firstName}} {{student.lastName}} - - -
+ + {% for user in users %} + + {{ user.username }} + {{ user.hasGraduated }} + {{ user.classLevel }} - + + {%endfor%} + + - {% endblock %} \ No newline at end of file From 29e2a056b6c16488cb4ec720a5ea437e9cffa389 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Thu, 12 Sep 2024 10:51:03 -0400 Subject: [PATCH 03/40] Imported graduationManagement in __init.py__ --- app/controllers/admin/__init__.py | 1 + app/controllers/admin/graduationManagement.py | 3 +++ app/templates/admin/testpage.html | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 app/templates/admin/testpage.html diff --git a/app/controllers/admin/__init__.py b/app/controllers/admin/__init__.py index 375c695bd..3b2b83790 100644 --- a/app/controllers/admin/__init__.py +++ b/app/controllers/admin/__init__.py @@ -11,4 +11,5 @@ from app.controllers.admin import userManagement from app.controllers.admin import volunteers from app.controllers.admin import minor +from app.controllers.admin import graduationManagement diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index 854a67d23..fef9abf23 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -14,3 +14,6 @@ def gradManagement(): return render_template('/admin/graduationManagement.html', users = users) + + + diff --git a/app/templates/admin/testpage.html b/app/templates/admin/testpage.html new file mode 100644 index 000000000..4c3e8bb1b --- /dev/null +++ b/app/templates/admin/testpage.html @@ -0,0 +1,2 @@ +{% extends "base.html" %} +

Hello there Kenobi

\ No newline at end of file From 2a57481f9b604de641ed69a9640bc048bac12e6f Mon Sep 17 00:00:00 2001 From: Karina Date: Thu, 12 Sep 2024 17:10:52 -0400 Subject: [PATCH 04/40] Added datatable, checkbox, styling, UI, and redirecting --- admin/graduationManagement | 39 +++++++++++++++++++ app/controllers/admin/graduationManagement.py | 3 +- app/static/js/graduationManagement.js | 21 ++++++++++ app/templates/admin/graduationManagement.html | 5 ++- 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 admin/graduationManagement diff --git a/admin/graduationManagement b/admin/graduationManagement new file mode 100644 index 000000000..1eb9bdcbd --- /dev/null +++ b/admin/graduationManagement @@ -0,0 +1,39 @@ +{% set title = "Graduation Management" %} +{% extends "base.html" %} + +{% block scripts %} + {{super()}} + + + + {% block styles %} + {{super()}} + + + {% endblock %} +{% endblock %} + +{% block app_content %} +

Graduation Management

+

Graduating/Graduated Students

+ + + + + + + + + + {% for user in users %} + + + + + + + {%endfor%} + +
NameGraduatedClass Level
{{ user.username }}{{ user.hasGraduated }}{{ user.classLevel }}
+ +{% endblock %} \ No newline at end of file diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index fef9abf23..3ad79fd3f 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -9,7 +9,8 @@ def gradManagement(): if not g.current_user.isAdmin: abort(403) - users = User.select(User.username, User.hasGraduated, User.classLevel) + users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName).where(User.classLevel=='Senior') + return render_template('/admin/graduationManagement.html', users = users) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index e69de29bb..290aad960 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -0,0 +1,21 @@ +$(document).ready(function() { + $('#gradStudentsTable').DataTable(); + + $('.graduated-checkbox').change(function() { + let isChecked = $(this).is(':checked'); + let username = $(this).data('username'); + + $.ajax({ + type: "POST", + url: "/graduationManagement/" + username + "/updateGraduationStatus", + data: { hasGraduated: isChecked }, + success: function(response) { + msgFlash("Graduation status has been updated!", "success"); + }, + error: function(error) { + msgToast("Error!", "Failed to update graduation status."); + $(this).prop('checked', !isChecked); // Revert checkbox state on error + } + }); + }); +}); diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 1eb9bdcbd..4d9012646 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -27,8 +27,9 @@

Graduating/Graduated Students

{% for user in users %} - {{ user.username }} - {{ user.hasGraduated }} + {{ user.firstName }} {{ user.lastName }} + + {{ user.classLevel }} From f55fc2d8cc68c2378b5639b60e34a2fca658abf4 Mon Sep 17 00:00:00 2001 From: Karina Date: Mon, 16 Sep 2024 10:06:22 -0400 Subject: [PATCH 05/40] Modified js and route --- app/controllers/admin/graduationManagement.py | 17 ++++++++++++++++- app/static/js/graduationManagement.js | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index 3ad79fd3f..7f7f17a15 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -3,7 +3,7 @@ from app.controllers.admin import admin_bp -@admin_bp.route('/admin/graduationManagement', methods=['GET']) +@admin_bp.route('/admin/graduationManagement', methods=['GET', 'POST']) def gradManagement(): if not g.current_user.isAdmin: @@ -11,6 +11,21 @@ def gradManagement(): users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName).where(User.classLevel=='Senior') + if request.method == 'POST': + username = request.form.get('username') + has_graduated = request.form.get('hasGraduated') == 'true' + + # Find the user by username + user = User.get_or_none(User.username == username) + + if user: + # Update the graduation status + user.hasGraduated = has_graduated + user.save() + return jsonify({"status": "success"}), 200 + else: + return jsonify({"status": "error", "message": "User not found"}), 404 + return render_template('/admin/graduationManagement.html', users = users) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 290aad960..359312d8e 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -7,8 +7,8 @@ $(document).ready(function() { $.ajax({ type: "POST", - url: "/graduationManagement/" + username + "/updateGraduationStatus", - data: { hasGraduated: isChecked }, + url: "/admin/graduationManagement/", + data: { username: username, hasGraduated: isChecked }, success: function(response) { msgFlash("Graduation status has been updated!", "success"); }, From 74c7dc83297a550a99e6253495db4605c1e8f629 Mon Sep 17 00:00:00 2001 From: Karina Date: Tue, 17 Sep 2024 15:04:53 -0400 Subject: [PATCH 06/40] Added buttons, fixed checkboxes --- app/controllers/admin/graduationManagement.py | 57 ++++++++++++------- app/logic/graduationManagement.py | 28 +++++++-- app/static/css/graduationManagement.css | 7 +++ app/static/js/graduationManagement.js | 30 +++++++--- app/templates/admin/graduationManagement.html | 18 ++++++ 5 files changed, 109 insertions(+), 31 deletions(-) create mode 100644 app/static/css/graduationManagement.css diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index 7f7f17a15..8f0717d46 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -1,9 +1,11 @@ -from flask import render_template, g, abort, request, redirect, url_for +from flask import render_template, g, abort, request, redirect, url_for, flash from app.models.user import User from app.controllers.admin import admin_bp +from app.logic.graduationManagement import getGraduatedStudent, removeGraduatedStudent -@admin_bp.route('/admin/graduationManagement', methods=['GET', 'POST']) + +@admin_bp.route('/admin/graduationManagement', methods=['GET']) def gradManagement(): if not g.current_user.isAdmin: @@ -11,25 +13,42 @@ def gradManagement(): users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName).where(User.classLevel=='Senior') - if request.method == 'POST': - username = request.form.get('username') - has_graduated = request.form.get('hasGraduated') == 'true' - - # Find the user by username - user = User.get_or_none(User.username == username) - - if user: - # Update the graduation status - user.hasGraduated = has_graduated - user.save() - return jsonify({"status": "success"}), 200 - else: - return jsonify({"status": "error", "message": "User not found"}), 404 - - return render_template('/admin/graduationManagement.html', users = users) - +@admin_bp.route('//hasGraduated/', methods=['POST']) +def hasGraduated(username): + """ + This function + username: unique value of a user to correctly identify them + """ + try: + success = getGraduatedStudent(username) + if success: + return "", 200 + else: + return "", 500 + + except Exception as e: + print(e) + return "Error Updating Graduation Status", 500 + +@admin_bp.route('//hasNotGraduated/', methods=['POST']) +def hasNotGraduated(username): + """ + This function removes + username: unique value of a user to correctly identify them + """ + try: + removed = removeGraduatedStudent(username) + if removed: + flash("Graduation status has been updated!", "success") + return "", 200 + else: + flash("Error!", "Failed to update graduation status.") + return "", 500 + except Exception as e: + print(e) + return "Error Updating Graduation Status", 500 diff --git a/app/logic/graduationManagement.py b/app/logic/graduationManagement.py index b2d360468..12a416fa7 100644 --- a/app/logic/graduationManagement.py +++ b/app/logic/graduationManagement.py @@ -6,10 +6,30 @@ from app.models.user import User from app.models.term import Term -def getGraduatedStudents(): + +def getGraduatedStudent(username): + """ + This function marks students as graduated + Parameters: + username: username of the user graduating """ - Get all the users who graduated + gradStudent = User.get(User.username == username) + if gradStudent: + gradStudent.hasGraduated = True + gradStudent.save() + return True + return False + +def removeGraduatedStudent(username): """ - graduatedStudents = User.select().where(User.hasGraduated) + This function unmarks students as graduated + Parameters: + username: username of the user graduating - return graduatedStudents \ No newline at end of file + """ + notGradStudent = User.get(User.username == username) + if notGradStudent: + notGradStudent.hasGraduated = False + notGradStudent.save() + return True + return False \ No newline at end of file diff --git a/app/static/css/graduationManagement.css b/app/static/css/graduationManagement.css new file mode 100644 index 000000000..21d2dc6e5 --- /dev/null +++ b/app/static/css/graduationManagement.css @@ -0,0 +1,7 @@ +#selectAll-container { + text-align: center; + margin-bottom: 15px; + } + .btn { + margin-top: 10px; + } \ No newline at end of file diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 359312d8e..d3097d0fd 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -1,21 +1,35 @@ $(document).ready(function() { $('#gradStudentsTable').DataTable(); + let selectAllMode = true; $('.graduated-checkbox').change(function() { - let isChecked = $(this).is(':checked'); + let hasGraduated = $(this).is(':checked'); let username = $(this).data('username'); - + let routeUrl = hasGraduated ? "hasGraduated" : "hasNotGraduated"; + let graduationURL = "/" + username + "/" + routeUrl + "/" + $.ajax({ type: "POST", - url: "/admin/graduationManagement/", - data: { username: username, hasGraduated: isChecked }, + url: graduationURL, success: function(response) { - msgFlash("Graduation status has been updated!", "success"); + msgFlash("Graduation status updated successfully!", "success") + console.log("Graduation status updated successfully!"); }, - error: function(error) { - msgToast("Error!", "Failed to update graduation status."); - $(this).prop('checked', !isChecked); // Revert checkbox state on error + error: function(status, error) { + msgFlash("Graduation status updated successfully!", "error") + console.error("Error updating graduation status:", error); } }); }); + $('#selectAll').click(function() { + let checkboxes = $('.graduated-checkbox'); + if (selectAllMode) { + checkboxes.prop('checked', true).change(); + $(this).text('Deselect All'); + } else { + checkboxes.prop('checked', false).change(); + $(this).text('Select All'); + } + selectAllMode = !selectAllMode; // Toggle the state + }); }); diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 4d9012646..334476c1c 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -3,11 +3,14 @@ {% block scripts %} {{super()}} + + {% block styles %} {{super()}} + {% endblock %} @@ -16,6 +19,21 @@ {% block app_content %}

Graduation Management

Graduating/Graduated Students

+ +
+ +
From d6cc41b20591064d441e06dd4837509c91022801 Mon Sep 17 00:00:00 2001 From: Karina Date: Tue, 17 Sep 2024 17:57:13 -0400 Subject: [PATCH 07/40] Added buttons --- app/controllers/admin/graduationManagement.py | 7 +++++-- app/logic/graduationManagement.py | 10 +++++++++- app/templates/admin/graduationManagement.html | 15 ++++++++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index 8f0717d46..e39050d87 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -2,7 +2,7 @@ from app.models.user import User from app.controllers.admin import admin_bp -from app.logic.graduationManagement import getGraduatedStudent, removeGraduatedStudent +from app.logic.graduationManagement import getGraduatedStudent, removeGraduatedStudent, getAllTerms @admin_bp.route('/admin/graduationManagement', methods=['GET']) @@ -12,8 +12,11 @@ def gradManagement(): abort(403) users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName).where(User.classLevel=='Senior') + selectedTerm = getAllTerms() - return render_template('/admin/graduationManagement.html', users = users) + return render_template('/admin/graduationManagement.html', users = users, + selectedTerm = selectedTerm, + allTerms = getAllTerms()) @admin_bp.route('//hasGraduated/', methods=['POST']) diff --git a/app/logic/graduationManagement.py b/app/logic/graduationManagement.py index 12a416fa7..2a6f90d67 100644 --- a/app/logic/graduationManagement.py +++ b/app/logic/graduationManagement.py @@ -32,4 +32,12 @@ def removeGraduatedStudent(username): notGradStudent.hasGraduated = False notGradStudent.save() return True - return False \ No newline at end of file + return False + +def getAllTerms(): + """ + Return a list of all terms + """ + allTerms = list(Term.select().order_by(Term.termOrder)) + + return allTerms \ No newline at end of file diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 334476c1c..7acbb99e8 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -4,7 +4,6 @@ {% block scripts %} {{super()}} - @@ -19,7 +18,16 @@ {% block app_content %}

Graduation Management

Graduating/Graduated Students

- +
+
From 031a7b8d0702f59a593e71e6d1c8c14b5eb28b39 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Thu, 19 Sep 2024 12:17:15 -0400 Subject: [PATCH 08/40] changed filters on grad management drop down menu --- app/controllers/admin/graduationManagement.py | 2 +- app/static/js/graduationManagement.js | 46 ++++++++++++++++++- app/templates/admin/graduationManagement.html | 8 ++-- 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index e39050d87..34ac4ab55 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -11,7 +11,7 @@ def gradManagement(): if not g.current_user.isAdmin: abort(403) - users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName).where(User.classLevel=='Senior') + users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName, User.isBonnerScholar).where(User.classLevel=='Senior') selectedTerm = getAllTerms() return render_template('/admin/graduationManagement.html', users = users, diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index d3097d0fd..612fa0bda 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -1,6 +1,46 @@ $(document).ready(function() { - $('#gradStudentsTable').DataTable(); + //var gradStudentsTable = $('#gradStudentsTable').DataTable(); let selectAllMode = true; + + // // Handle filter selection + // $('.dropdown-item').click(function(e) { + // var filterStudents = $(this).attr('href').substring(1); // Get filter type from href attribute (#all, #bonner, #minor) + // if (filterStudents === 'all') { + // // Show all students + // gradStudentsTable.search('').draw(); + // } else if (filterStudents === 'bonner') { + // // Filter for Bonner students + // gradStudentsTable.columns(0).search('bonner').draw(); + // } else if (filterStudents === 'minor') { + // // Filter for Minor students + // gradStudentsTable.columns(0).search('minor').draw(); + // } + // // Prevent default action + // e.preventDefault(); + + // Initialize the DataTable + var table = $('#gradStudentsTable').DataTable(); + // Handle filter selection + $('.dropdown-item').click(function() { + var filterType = $(this).data('filter'); // Get the filter type from the data-filter attribute + if (filterType === 'all') { + // Show all students + table.rows().show().draw(); + } else { + // Filter based on the student type + table.rows().every(function(rowIdx, tableLoop, rowLoop) { + var studentType = $(this.node()).data('student-type'); // Get the data-student-type attribute from each row + if (studentType === filterType) { + $(this.node()).show(); // Show the row if it matches the filter + } else { + $(this.node()).hide(); // Hide the row if it doesn't match + } + }); + table.draw(); + } + + }); + $('.graduated-checkbox').change(function() { let hasGraduated = $(this).is(':checked'); @@ -32,4 +72,8 @@ $(document).ready(function() { } selectAllMode = !selectAllMode; // Toggle the state }); + + //handle filter + + }); diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 7acbb99e8..5e18d5b6a 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -33,9 +33,9 @@

Graduating/Graduated Students

All @@ -53,7 +53,7 @@

Graduating/Graduated Students

{% for user in users %} - + From 3367862fa1e73d3365237a1e672783870e74b364 Mon Sep 17 00:00:00 2001 From: Karina Date: Fri, 20 Sep 2024 10:57:00 -0400 Subject: [PATCH 09/40] Fixed filter for bonner students --- app/controllers/admin/graduationManagement.py | 2 +- app/static/js/graduationManagement.js | 57 ++++++++----------- app/templates/admin/graduationManagement.html | 1 - 3 files changed, 25 insertions(+), 35 deletions(-) diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index 34ac4ab55..e39050d87 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -11,7 +11,7 @@ def gradManagement(): if not g.current_user.isAdmin: abort(403) - users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName, User.isBonnerScholar).where(User.classLevel=='Senior') + users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName).where(User.classLevel=='Senior') selectedTerm = getAllTerms() return render_template('/admin/graduationManagement.html', users = users, diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 612fa0bda..e94561c7c 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -1,47 +1,38 @@ $(document).ready(function() { - //var gradStudentsTable = $('#gradStudentsTable').DataTable(); + var gradStudentsTable = $('#gradStudentsTable').DataTable({ + paging: true, + searching: true, + info: true + }); let selectAllMode = true; - // // Handle filter selection - // $('.dropdown-item').click(function(e) { - // var filterStudents = $(this).attr('href').substring(1); // Get filter type from href attribute (#all, #bonner, #minor) - // if (filterStudents === 'all') { - // // Show all students - // gradStudentsTable.search('').draw(); - // } else if (filterStudents === 'bonner') { - // // Filter for Bonner students - // gradStudentsTable.columns(0).search('bonner').draw(); - // } else if (filterStudents === 'minor') { - // // Filter for Minor students - // gradStudentsTable.columns(0).search('minor').draw(); - // } - // // Prevent default action - // e.preventDefault(); - - // Initialize the DataTable - var table = $('#gradStudentsTable').DataTable(); - // Handle filter selection $('.dropdown-item').click(function() { - var filterType = $(this).data('filter'); // Get the filter type from the data-filter attribute + var filterType = $(this).data('filter'); + + console.log('Filter type selected:', filterType); + if (filterType === 'all') { - // Show all students - table.rows().show().draw(); - } else { - // Filter based on the student type - table.rows().every(function(rowIdx, tableLoop, rowLoop) { - var studentType = $(this.node()).data('student-type'); // Get the data-student-type attribute from each row - if (studentType === filterType) { - $(this.node()).show(); // Show the row if it matches the filter + console.log('Showing all students'); + gradStudentsTable.search('').draw(); + gradStudentsTable.rows().every(function() { + $(this.node()).show(); + }); + gradStudentsTable.draw(); + } else if (filterType === 'bonner') { + console.log('Showing only Bonner students'); + + gradStudentsTable.rows().every(function() { + var studentType = $(this.node()).data('student-type'); + if (studentType === 'bonner') { + $(this.node()).show(); } else { - $(this.node()).hide(); // Hide the row if it doesn't match + $(this.node()).hide(); } }); - table.draw(); + gradStudentsTable.draw(); } - }); - $('.graduated-checkbox').change(function() { let hasGraduated = $(this).is(':checked'); let username = $(this).data('username'); diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 5e18d5b6a..80a5b1df9 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -35,7 +35,6 @@

Graduating/Graduated Students

From 12b715c93db2f172f8a5b552fd77a6bf6cdff7bc Mon Sep 17 00:00:00 2001 From: Karina Date: Fri, 20 Sep 2024 10:59:06 -0400 Subject: [PATCH 10/40] got rid of print statements --- app/static/js/graduationManagement.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index e94561c7c..51abfe07d 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -9,18 +9,13 @@ $(document).ready(function() { $('.dropdown-item').click(function() { var filterType = $(this).data('filter'); - console.log('Filter type selected:', filterType); - if (filterType === 'all') { - console.log('Showing all students'); gradStudentsTable.search('').draw(); gradStudentsTable.rows().every(function() { $(this.node()).show(); }); gradStudentsTable.draw(); } else if (filterType === 'bonner') { - console.log('Showing only Bonner students'); - gradStudentsTable.rows().every(function() { var studentType = $(this.node()).data('student-type'); if (studentType === 'bonner') { From f25cd0327ab054eff1920a2b659daa9528c36b1d Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Fri, 20 Sep 2024 12:27:59 -0400 Subject: [PATCH 11/40] made changes to grad manag css file. --- app/static/css/graduationManagement.css | 8 +++++++- app/templates/admin/graduationManagement.html | 13 ++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/static/css/graduationManagement.css b/app/static/css/graduationManagement.css index 21d2dc6e5..bd3eb7447 100644 --- a/app/static/css/graduationManagement.css +++ b/app/static/css/graduationManagement.css @@ -4,4 +4,10 @@ } .btn { margin-top: 10px; - } \ No newline at end of file + } + +.btn-group { + text-align: center; + + margin-top: 500px; +} \ No newline at end of file diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 80a5b1df9..8d691e3bb 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -15,19 +15,22 @@ {% endblock %} {% endblock %} + + {% block app_content %}

Graduation Management

-

Graduating/Graduated Students

-
+
- {% for term in selectedTerm %} {% endfor %}
-
-
+ +

Graduating/Graduated Students

+

Graduating/Graduated Students

-
+
- - + + +
+ +
+ +
-
- - -
+
{{ user.firstName }} {{ user.lastName }}
From b3540655ccd67ff1605110d9c1de97255b31e0a1 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Tue, 24 Sep 2024 10:36:02 -0400 Subject: [PATCH 13/40] Adjusted positioning of the term bar in graduation management --- app/static/css/graduationManagement.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/static/css/graduationManagement.css b/app/static/css/graduationManagement.css index eb2f37e8e..24b601b60 100644 --- a/app/static/css/graduationManagement.css +++ b/app/static/css/graduationManagement.css @@ -17,3 +17,8 @@ h1 { .container { margin-bottom: 20px; /* Adjust this as needed for proper spacing */ } + +.w-25{ + margin-bottom: 50px; + + } \ No newline at end of file From 201e9850491176d73a577eca948d78c180ca52d8 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Thu, 26 Sep 2024 09:36:15 -0400 Subject: [PATCH 14/40] Removed Header and dropdown menu for term on Grad Managment Page. --- app/static/js/graduationManagement.js | 13 +++++++++++++ app/templates/admin/graduationManagement.html | 11 +---------- app/templates/admin/testpage.html | 2 -- 3 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 app/templates/admin/testpage.html diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index b05e45c0b..990cdffeb 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -18,6 +18,7 @@ $(document).ready(function() { $(this.node()).show(); }); gradStudentsTable.draw(); + } else if (filterType === 'bonner') { gradStudentsTable.rows().every(function() { var studentType = $(this.node()).data('student-type'); @@ -28,6 +29,18 @@ $(document).ready(function() { } }); gradStudentsTable.draw(); + + } else if (filterType === 'cce') { + gradStudentsTable.rows().every(function() { + var studentType = $(this.node()).data('student-type'); + if (studentType === 'cce') { + $(this.node()).show(); + } else { + $(this.node()).hide(); + } + }); + gradStudentsTable.draw(); + } }); diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 0ed865acb..80a8ac99f 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -20,16 +20,6 @@ {% block app_content %}

Graduation Management

-
-
- -
- -

Graduating/Graduated Students

diff --git a/app/templates/admin/testpage.html b/app/templates/admin/testpage.html deleted file mode 100644 index 4c3e8bb1b..000000000 --- a/app/templates/admin/testpage.html +++ /dev/null @@ -1,2 +0,0 @@ -{% extends "base.html" %} -

Hello there Kenobi

\ No newline at end of file From b01bbf49b52e80deacd1ce1255237662f51f573b Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Thu, 26 Sep 2024 12:22:45 -0400 Subject: [PATCH 15/40] added bonner dropdown menu and added new filter function in grad management javascript --- app/controllers/admin/graduationManagement.py | 6 +++++- app/logic/graduationManagement.py | 7 ------- app/static/js/graduationManagement.js | 19 +++++++++++++++++++ app/templates/admin/graduationManagement.html | 18 ++++++++++++++---- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index e39050d87..e5f40bb62 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -1,6 +1,8 @@ from flask import render_template, g, abort, request, redirect, url_for, flash from app.models.user import User from app.controllers.admin import admin_bp +from app.logic.bonner import getBonnerCohorts +from app.models.bonnerCohort import BonnerCohort from app.logic.graduationManagement import getGraduatedStudent, removeGraduatedStudent, getAllTerms @@ -14,9 +16,11 @@ def gradManagement(): users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName).where(User.classLevel=='Senior') selectedTerm = getAllTerms() + bonnercohorts = getBonnerCohorts() + return render_template('/admin/graduationManagement.html', users = users, selectedTerm = selectedTerm, - allTerms = getAllTerms()) + bonnercohorts = bonnercohorts) @admin_bp.route('//hasGraduated/', methods=['POST']) diff --git a/app/logic/graduationManagement.py b/app/logic/graduationManagement.py index 2a6f90d67..598bfd7fd 100644 --- a/app/logic/graduationManagement.py +++ b/app/logic/graduationManagement.py @@ -34,10 +34,3 @@ def removeGraduatedStudent(username): return True return False -def getAllTerms(): - """ - Return a list of all terms - """ - allTerms = list(Term.select().order_by(Term.termOrder)) - - return allTerms \ No newline at end of file diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 990cdffeb..b4bc2700b 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -44,6 +44,25 @@ $(document).ready(function() { } }); + $('.dropdown-item-new').click(function() { + + var BfilterType = $(this).data('filter'); + + if (BfilterType === 'bonnercohort') { + gradStudentsTable.rows().every(function() { + var studentType = $(this.node()).data('student-type'); + if (studentType === 'bonnercohort') { + $(this.node()).show(); + } else { + $(this.node()).hide(); + } + }); + gradStudentsTable.draw(); + + + } + }); + $('.graduated-checkbox').change(function() { let hasGraduated = $(this).is(':checked'); let username = $(this).data('username'); diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 80a8ac99f..0647620e5 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -22,13 +22,23 @@

Graduation Management

+
+ +
From d9cbb527780ac51c163b9bfd0df4cca2f077a098 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Tue, 1 Oct 2024 09:17:37 -0400 Subject: [PATCH 16/40] Added JS for bonner cohorts menu --- app/controllers/admin/graduationManagement.py | 8 ++++---- app/static/js/graduationManagement.js | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index e5f40bb62..d274a2b2a 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -4,7 +4,7 @@ from app.logic.bonner import getBonnerCohorts from app.models.bonnerCohort import BonnerCohort -from app.logic.graduationManagement import getGraduatedStudent, removeGraduatedStudent, getAllTerms +#from app.logic.graduationManagement import getGraduatedStudent, removeGraduatedStudent, getAllTerms @admin_bp.route('/admin/graduationManagement', methods=['GET']) @@ -14,12 +14,12 @@ def gradManagement(): abort(403) users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName).where(User.classLevel=='Senior') - selectedTerm = getAllTerms() + #selectedTerm = getAllTerms() bonnercohorts = getBonnerCohorts() - + return render_template('/admin/graduationManagement.html', users = users, - selectedTerm = selectedTerm, + #selectedTerm = selectedTerm, bonnercohorts = bonnercohorts) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index b4bc2700b..5c44dff5d 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -19,7 +19,7 @@ $(document).ready(function() { }); gradStudentsTable.draw(); - } else if (filterType === 'bonner') { + } else if (filterType === 'bonner' ) { gradStudentsTable.rows().every(function() { var studentType = $(this.node()).data('student-type'); if (studentType === 'bonner') { @@ -46,7 +46,17 @@ $(document).ready(function() { $('.dropdown-item-new').click(function() { - var BfilterType = $(this).data('filter'); + var BfilterType = $(this).data('newfilter'); + var year = $(this).text(); + + year = year.substring(0,4) + + msgFlash(year) + + year = Integer.parseInt(year); + + + if (BfilterType === 'bonnercohort') { gradStudentsTable.rows().every(function() { From 4c391ded3903acab10560f65a0b3ffc45ab461dd Mon Sep 17 00:00:00 2001 From: Karina Date: Tue, 1 Oct 2024 15:03:57 -0400 Subject: [PATCH 17/40] Fixed the dropdowns --- app/controllers/admin/graduationManagement.py | 4 +- app/static/js/graduationManagement.js | 48 +++++++++---------- app/templates/admin/graduationManagement.html | 2 +- 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index d274a2b2a..fa2257f3f 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -4,7 +4,7 @@ from app.logic.bonner import getBonnerCohorts from app.models.bonnerCohort import BonnerCohort -#from app.logic.graduationManagement import getGraduatedStudent, removeGraduatedStudent, getAllTerms +from app.logic.graduationManagement import getGraduatedStudent, removeGraduatedStudent @admin_bp.route('/admin/graduationManagement', methods=['GET']) @@ -14,12 +14,10 @@ def gradManagement(): abort(403) users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName).where(User.classLevel=='Senior') - #selectedTerm = getAllTerms() bonnercohorts = getBonnerCohorts() return render_template('/admin/graduationManagement.html', users = users, - #selectedTerm = selectedTerm, bonnercohorts = bonnercohorts) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 5c44dff5d..4637986cc 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -10,7 +10,7 @@ $(document).ready(function() { var filterType = $(this).data('filter'); var buttonText = $(this).text(); - $('.dropdown-toggle').text(buttonText); + $('.dropdown-toggle').first().text(buttonText); if (filterType === 'all') { gradStudentsTable.search('').draw(); @@ -45,32 +45,30 @@ $(document).ready(function() { }); $('.dropdown-item-new').click(function() { + + var cohortYear = $(this).data('cohort-year'); + var buttonText = $(this).text(); - var BfilterType = $(this).data('newfilter'); - var year = $(this).text(); - - year = year.substring(0,4) - - msgFlash(year) - - year = Integer.parseInt(year); - - - - - if (BfilterType === 'bonnercohort') { - gradStudentsTable.rows().every(function() { - var studentType = $(this.node()).data('student-type'); - if (studentType === 'bonnercohort') { - $(this.node()).show(); - } else { - $(this.node()).hide(); - } - }); - gradStudentsTable.draw(); - + $('.dropdown-toggle.bonner-filter').text(buttonText); + + gradStudentsTable.rows().every(function() { + var studentYear = $(this.node()).data('cohort-year'); + if (studentYear == cohortYear) { + $(this.node()).show(); + } else { + $(this.node()).hide(); + } + }); + gradStudentsTable.draw(); - } + $('.dropdown-menu .dropdown-item-new').each(function() { + var itemYear = $(this).data('cohort-year'); + if (itemYear == cohortYear) { + $(this).addClass('active'); + } else { + $(this).removeClass('active'); + } + }); }); $('.graduated-checkbox').change(function() { diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 0647620e5..961d9f562 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -37,7 +37,7 @@

Graduation Management

From 1de2f16b8f419eba209b109101579007940e333c Mon Sep 17 00:00:00 2001 From: Karina Date: Wed, 9 Oct 2024 10:36:05 -0400 Subject: [PATCH 18/40] Changes to table bonner cohorts --- app/static/js/graduationManagement.js | 7 +++++-- app/templates/admin/graduationManagement.html | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 4637986cc..4989f9de1 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -52,12 +52,15 @@ $(document).ready(function() { $('.dropdown-toggle.bonner-filter').text(buttonText); gradStudentsTable.rows().every(function() { - var studentYear = $(this.node()).data('cohort-year'); - if (studentYear == cohortYear) { + var studentCohort = $(this.node()).data('student-cohort'); + console.log(studentCohort) + if (studentCohort == cohortYear) { $(this.node()).show(); + console.log("+++++++++++++++++++++++++", studentCohort); } else { $(this.node()).hide(); } + }); gradStudentsTable.draw(); diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 961d9f562..c7403be8e 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -36,8 +36,15 @@

Graduation Management

Bonner Cohorts
+ + + {% endfor %} {%endfor%} From f20b904e1ee1ca82d962d6ab1bbb0652c0e06f05 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Thu, 10 Oct 2024 11:31:06 -0400 Subject: [PATCH 19/40] Users can now be passed into gradmanagment.js --- app/static/js/graduationManagement.js | 12 ++++++++++++ app/templates/admin/graduationManagement.html | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 4637986cc..fd126f8bb 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -5,6 +5,8 @@ $(document).ready(function() { info: true }); let selectAllMode = true; + + $('.dropdown-item').click(function() { var filterType = $(this).data('filter'); @@ -49,6 +51,16 @@ $(document).ready(function() { var cohortYear = $(this).data('cohort-year'); var buttonText = $(this).text(); + var cohortusers = $(this).data('cohort-users'); + + // dictionary = $('#user-year').data(); + + // console.log(dictionary) + + console.log(cohortYear) + console.log(cohortusers) + + $('.dropdown-toggle.bonner-filter').text(buttonText); gradStudentsTable.rows().every(function() { diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 961d9f562..e334b9c97 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -1,5 +1,6 @@ {% set title = "Graduation Management" %} {% extends "base.html" %} +{% set bonnerCo = bonnercohorts %} {% block scripts %} {{super()}} @@ -7,6 +8,8 @@ + + {% block styles %} {{super()}} @@ -18,6 +21,7 @@ {% block app_content %} +

Graduation Management

@@ -37,7 +41,7 @@

Graduation Management

From 1f28bea758db0a5217d2d7fa4947c153da6bb1d9 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Tue, 15 Oct 2024 10:24:26 -0400 Subject: [PATCH 20/40] Filter to show bonner stundents by year now works, but the filter is off by 1 year (If a student graduted in 2022, then they will only show up if u click 2023) --- app/static/js/graduationManagement.js | 62 ++++++++++++------- app/templates/admin/graduationManagement.html | 6 +- 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index fd126f8bb..6d8469109 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -47,40 +47,58 @@ $(document).ready(function() { }); $('.dropdown-item-new').click(function() { - + var cohortYear = $(this).data('cohort-year'); + var cohortusers = $(this).data('cohort-users'); var buttonText = $(this).text(); + + //Make list of users from cohort users - var cohortusers = $(this).data('cohort-users'); + const cleanedString = cohortusers + .replace(/^\[|\]$/g, '') // Remove the square brackets + .replace(//g, '') // Remove "" + .trim(); // Trim any leading or trailing whitespace - // dictionary = $('#user-year').data(); + const CohortArray = cleanedString.split(',').map(user => user.trim()); - // console.log(dictionary) + - console.log(cohortYear) - console.log(cohortusers) - $('.dropdown-toggle.bonner-filter').text(buttonText); gradStudentsTable.rows().every(function() { - var studentYear = $(this.node()).data('cohort-year'); - if (studentYear == cohortYear) { - $(this.node()).show(); - } else { - $(this.node()).hide(); - } - }); - gradStudentsTable.draw(); + var studentUserName = $(this.node()).data('username'); - $('.dropdown-menu .dropdown-item-new').each(function() { - var itemYear = $(this).data('cohort-year'); - if (itemYear == cohortYear) { - $(this).addClass('active'); - } else { - $(this).removeClass('active'); - } + console.log('Cohort List: ', CohortArray) + + for ( let i = 0 ; i < CohortArray.length ; i++){ + + console.log('found: ', studentUserName, ' looking for: ', CohortArray[i]) + + var studentType = $(this.node()).data('student-type'); + if (studentType === 'bonner'&& studentUserName == CohortArray[i]) { + $(this.node()).show(); + console.log("True") + } else { + $(this.node()).hide(); + console.log("false") + } + + + + + // if (studentUserName == CohortArray[i]) { + // $(this.node()).show(); + // console.log('found: ', studentUserName, ' looking for: ', CohortArray[i]) + // console.log(" TRUE ") + // } else { + // $(this.node()).hide(); + // console.log('found: ', studentUserName, ' looking for: ', CohortArray[i]) + // console.log(" FALSE ") + // } + } }); + gradStudentsTable.draw(); }); $('.graduated-checkbox').change(function() { diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index e334b9c97..76153a6bd 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -2,6 +2,7 @@ {% extends "base.html" %} {% set bonnerCo = bonnercohorts %} + {% block scripts %} {{super()}} @@ -21,7 +22,6 @@ {% block app_content %} -

Graduation Management

@@ -41,7 +41,7 @@

Graduation Management

@@ -62,7 +62,7 @@

Graduation Management

{% for user in users %} - + From d797b30697d035a82e62db8148baf85f6cbe04ba Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Tue, 15 Oct 2024 17:24:12 -0400 Subject: [PATCH 21/40] added break to loop in grad management loop --- app/static/js/graduationManagement.js | 26 ++++--------------- app/templates/admin/graduationManagement.html | 2 +- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 6d8469109..407e7af71 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -65,39 +65,23 @@ $(document).ready(function() { $('.dropdown-toggle.bonner-filter').text(buttonText); - + + gradStudentsTable.rows().every(function() { var studentUserName = $(this.node()).data('username'); - - console.log('Cohort List: ', CohortArray) for ( let i = 0 ; i < CohortArray.length ; i++){ - console.log('found: ', studentUserName, ' looking for: ', CohortArray[i]) - var studentType = $(this.node()).data('student-type'); - if (studentType === 'bonner'&& studentUserName == CohortArray[i]) { + if (studentType === 'bonner' && studentUserName == CohortArray[i]) { $(this.node()).show(); - console.log("True") + { break; } } else { $(this.node()).hide(); - console.log("false") } - - - - - // if (studentUserName == CohortArray[i]) { - // $(this.node()).show(); - // console.log('found: ', studentUserName, ' looking for: ', CohortArray[i]) - // console.log(" TRUE ") - // } else { - // $(this.node()).hide(); - // console.log('found: ', studentUserName, ' looking for: ', CohortArray[i]) - // console.log(" FALSE ") - // } } }); + gradStudentsTable.draw(); }); diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 76153a6bd..6e4264d6f 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -41,7 +41,7 @@

Graduation Management

From a25036b2bd702b8bcee3dab9a60d9429b90d0d2d Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Tue, 15 Oct 2024 17:38:46 -0400 Subject: [PATCH 22/40] git --- app/controllers/admin/graduationManagement.py | 1 + app/static/js/graduationManagement.js | 17 +---------------- app/templates/admin/graduationManagement.html | 14 +------------- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index fa2257f3f..b619383eb 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -15,6 +15,7 @@ def gradManagement(): users = User.select(User.username, User.hasGraduated, User.classLevel, User.firstName, User.lastName).where(User.classLevel=='Senior') + bonnercohorts = getBonnerCohorts() return render_template('/admin/graduationManagement.html', users = users, diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index af693b773..3e13d4bed 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -52,22 +52,7 @@ $(document).ready(function() { var cohortusers = $(this).data('cohort-users'); var buttonText = $(this).text(); -<<<<<<< HEAD //Make list of users from cohort users -======= - gradStudentsTable.rows().every(function() { - var studentCohort = $(this.node()).data('student-cohort'); - console.log(studentCohort) - if (studentCohort == cohortYear) { - $(this.node()).show(); - console.log("+++++++++++++++++++++++++", studentCohort); - } else { - $(this.node()).hide(); - } - - }); - gradStudentsTable.draw(); ->>>>>>> 1de2f16b8f419eba209b109101579007940e333c const cleanedString = cohortusers .replace(/^\[|\]$/g, '') // Remove the square brackets @@ -81,7 +66,7 @@ $(document).ready(function() { $('.dropdown-toggle.bonner-filter').text(buttonText); - + gradStudentsTable.rows().every(function() { var studentUserName = $(this.node()).data('username'); diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 711b3e821..00e58e60c 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -40,20 +40,8 @@

Graduation Management

Bonner Cohorts
- - - {% endfor %} ->>>>>>> 1de2f16b8f419eba209b109101579007940e333c + {{year}}-{{year+1}} {%endfor%} From 13f81eb2cd3ea495ed81048f261af897cd6a4044 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Tue, 15 Oct 2024 18:04:40 -0400 Subject: [PATCH 23/40] Made it to where the table clears upon selecting a specific year for bonner cohorts in graduationManagement JavaScript --- app/static/js/graduationManagement.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 3e13d4bed..f68a79086 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -51,7 +51,12 @@ $(document).ready(function() { var cohortYear = $(this).data('cohort-year'); var cohortusers = $(this).data('cohort-users'); var buttonText = $(this).text(); - + + // clear table + gradStudentsTable.rows().every(function(){ + $(this.node()).hide(); + }) + //Make list of users from cohort users const cleanedString = cohortusers @@ -61,15 +66,12 @@ $(document).ready(function() { const CohortArray = cleanedString.split(',').map(user => user.trim()); - - - $('.dropdown-toggle.bonner-filter').text(buttonText); - + //if list isnt empty then add users on list gradStudentsTable.rows().every(function() { var studentUserName = $(this.node()).data('username'); - + for ( let i = 0 ; i < CohortArray.length ; i++){ var studentType = $(this.node()).data('student-type'); @@ -79,7 +81,8 @@ $(document).ready(function() { } else { $(this.node()).hide(); } - } + } + }); gradStudentsTable.draw(); From 1d1b1c8f5b3cbb02ccad6b45009c49b3c3ea4939 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Thu, 17 Oct 2024 10:09:43 -0400 Subject: [PATCH 24/40] Fixed the sidebar and bonner cohort drop down menu text --- app/static/js/graduationManagement.js | 10 ++++------ app/templates/admin/graduationManagement.html | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index f68a79086..629e58eee 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -12,7 +12,7 @@ $(document).ready(function() { var filterType = $(this).data('filter'); var buttonText = $(this).text(); - $('.dropdown-toggle').first().text(buttonText); + $('#main-filter').first().text(buttonText); if (filterType === 'all') { gradStudentsTable.search('').draw(); @@ -48,10 +48,11 @@ $(document).ready(function() { $('.dropdown-item-new').click(function() { - var cohortYear = $(this).data('cohort-year'); var cohortusers = $(this).data('cohort-users'); var buttonText = $(this).text(); + $('.dropdown-toggle.bonner-filter').text(buttonText); + // clear table gradStudentsTable.rows().every(function(){ $(this.node()).hide(); @@ -66,8 +67,6 @@ $(document).ready(function() { const CohortArray = cleanedString.split(',').map(user => user.trim()); - $('.dropdown-toggle.bonner-filter').text(buttonText); - //if list isnt empty then add users on list gradStudentsTable.rows().every(function() { var studentUserName = $(this.node()).data('username'); @@ -81,8 +80,7 @@ $(document).ready(function() { } else { $(this.node()).hide(); } - } - + } }); gradStudentsTable.draw(); diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 00e58e60c..331aa7ad9 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -26,7 +26,7 @@

Graduation Management

- From ed01ecd0e9e9c4009aca340594ae5b903199278b Mon Sep 17 00:00:00 2001 From: Karina Date: Fri, 25 Oct 2024 14:48:34 -0400 Subject: [PATCH 29/40] Fixed a few things with export, still need more work --- app/controllers/admin/graduationManagement.py | 3 ++- app/logic/graduationManagement.py | 8 +++----- app/static/js/graduationManagement.js | 11 ++++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index 6d41fb174..25778b167 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -66,6 +66,7 @@ def gradsxls(): if not g.current_user.isCeltsAdmin: abort(403) - newfile = makeGraduatedXls("all") + filterType = request.args.get('filterType', 'all') + newfile = makeGraduatedXls(filterType) return send_file(open(newfile, 'rb'), download_name='GraduatedStudents.xlsx', as_attachment=True) diff --git a/app/logic/graduationManagement.py b/app/logic/graduationManagement.py index 874cdd72e..955142c93 100644 --- a/app/logic/graduationManagement.py +++ b/app/logic/graduationManagement.py @@ -39,7 +39,7 @@ def removeGraduatedStudent(username): return True return False -def makeGraduatedXls(filterType='all'): +def makeGraduatedXls(filterType): """ Create and save a GraduatedStudent.xlsx file with all of the graduated students. Working with XLSX files: https://xlsxwriter.readthedocs.io/index.html @@ -78,11 +78,9 @@ def makeGraduatedXls(filterType='all'): worksheet.write(row, 0, f"{student.year} - {student.year+1}", bold) if filterType == 'cce': - worksheet.write(row, 0, student['firstName']) - worksheet.write(row, 1, student['lastName']) + worksheet.write(row, 0, f"{student['firstName']} {student['lastName']}") else: - worksheet.write(row, 0, student.firstName) - worksheet.write(row, 1, student.lastName) + worksheet.write(row, 0, f"{student.firstName} {student.lastName}") row += 1 diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 56d9b2b5a..7ec169bb6 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -16,6 +16,8 @@ $(document).ready(function() { $('#selectAll').text('Select All'); selectAllMode = true + $('#export').attr('href', `/gradStudentsxls?filterType=${filterType}`); + if (filterType === 'all') { gradStudentsTable.search('').draw(); gradStudentsTable.rows().every(function() { @@ -35,7 +37,6 @@ $(document).ready(function() { gradStudentsTable.draw(); } else if (filterType === 'cce') { - var cceUsers = $(this).data('cce'); const sanitizedString = cceUsers @@ -75,13 +76,11 @@ $(document).ready(function() { gradStudentsTable.rows().every(function() { var studentUserName = $(this.node()).data('username'); - for ( const [key, value] of Object.entries(CCElist)){ var username = key; - if ( studentUserName == username && CCElist[key] > 0 ) { $(this.node()).show(); - { break; } + break; } else { $(this.node()).hide(); } @@ -103,6 +102,8 @@ $(document).ready(function() { $('#selectAll').text('Select All'); selectAllMode = true + $('#export').attr('href', `/gradStudentsxls?filterType=${filterType}`); + gradStudentsTable.rows().every(function(){ $(this.node()).hide(); }) @@ -123,7 +124,7 @@ $(document).ready(function() { var studentType = $(this.node()).data('student-type'); if (studentType === 'bonner' && studentUserName == CohortArray[i]) { $(this.node()).show(); - { break; } + break; } else { $(this.node()).hide(); } From 0bd62fed49edc65d399694dde3632db66f7d0a58 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Fri, 25 Oct 2024 15:00:01 -0400 Subject: [PATCH 30/40] added delay to messages on gradmanagment js --- app/static/js/graduationManagement.js | 99 ++++++++++++++++--- app/templates/admin/graduationManagement.html | 3 +- 2 files changed, 85 insertions(+), 17 deletions(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 56d9b2b5a..e87a6dd36 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -133,25 +133,74 @@ $(document).ready(function() { gradStudentsTable.draw(); }); - $('.graduated-checkbox').change(function() { - let hasGraduated = $(this).is(':checked'); - let username = $(this).data('username'); - let routeUrl = hasGraduated ? "hasGraduated" : "hasNotGraduated"; - let graduationURL = "/" + username + "/" + routeUrl + "/" - - $.ajax({ - type: "POST", - url: graduationURL, - success: function(response) { - msgFlash("Graduation status updated successfully!", "success") + // $('.graduated-checkbox').change(function() { + // let hasGraduated = $(this).is(':checked'); + // let username = $(this).data('username'); + // let routeUrl = hasGraduated ? "hasGraduated" : "hasNotGraduated"; + // let graduationURL = "/" + username + "/" + routeUrl + "/" + + // $.ajax({ + // type: "POST", + // url: graduationURL, + // success: function(response) { + // msgFlash("Graduation status updated successfully!", "success") + // console.log("Graduation status updated successfully!"); + // }, + // error: function(status, error) { + // msgFlash("Graduation status updated successfully!", "error") + // console.error("Error updating graduation status:", error); + // } + // }); + // }); + +$('.graduated-checkbox').change(function() { + let hasGraduated = $(this).is(':checked'); + let username = $(this).data('username'); + let routeUrl = hasGraduated ? "hasGraduated" : "hasNotGraduated"; + let graduationURL = "/" + username + "/" + routeUrl + "/"; + var msgshown = $(this).data('msgshown') + + + + // console.log($(this).data('msgshown')) + + // $(this).data('msgshown','true'); + + + + // Reset the flag when the checkbox is changed + + $.ajax({ + type: "POST", + url: graduationURL, + success: function(response) { + + console.log('success', msgshown) + + if ((msgshown == false )) { + + console.log($(this).data('msgshown')) + + $('#gradCheck').data('msgshown', true); + + // msgFlash("Graduation status updated successfully!", "success"); console.log("Graduation status updated successfully!"); - }, - error: function(status, error) { - msgFlash("Graduation status updated successfully!", "error") - console.error("Error updating graduation status:", error); + msgFlash("Graduation status updated successfully!", "success"); + + MessageDelay() + } - }); + }, + error: function(status, error) { + // if (!messageDisplayed) { + // msgFlash("Error updating graduation status.", "error"); + // console.error("Error updating graduation status:", error); + // messageDisplayed = true; // Set the flag to true after displaying the message + // } + } }); +}); + $('#selectAll').click(function() { @@ -176,3 +225,21 @@ $(document).ready(function() { selectAllMode = !selectAllMode; }); }); + +function MessageDelay(){ + + //for loop, close each message except for the last one + $('.alert').alert('close'); + + + + return setTimeout(ResetTimer,5000) +} + +function ResetTimer(){ + console.log($('.alert').length) + + $('.alert').fadeOut('fast'); + console.log("reset timer") + $('#gradCheck').data('msgshown',false); +} \ No newline at end of file diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 00e859e27..cd268b3e1 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -2,6 +2,7 @@ {% extends "base.html" %} + {% block scripts %} {{super()}} @@ -68,7 +69,7 @@

Graduation Managment

- + From 749fabf54332e8c3259c3b60d2da601ec7936b7b Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Tue, 29 Oct 2024 15:30:42 -0400 Subject: [PATCH 31/40] Add condition to where only one flash message shows up at a time on graduation management page. --- app/static/js/graduationManagement.js | 84 ++++--------------- app/static/js/sidebar.js | 2 + app/templates/admin/graduationManagement.html | 2 +- 3 files changed, 20 insertions(+), 68 deletions(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index cd8c6985e..e572afd96 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -6,6 +6,8 @@ $(document).ready(function() { }); let selectAllMode = true; + $('.alert').alert('close'); + $('.dropdown-item').click(function() { var filterType = $(this).data('filter'); var buttonText = $(this).text(); @@ -102,13 +104,9 @@ $(document).ready(function() { $('#selectAll').text('Select All'); selectAllMode = true - $('#export').attr('href', `/gradStudentsxls?filterType=${filterType}`); - gradStudentsTable.rows().every(function(){ $(this.node()).hide(); }) - - const cleanedString = cohortusers .replace(/^\[|\]$/g, '') .replace(//g, '') @@ -130,74 +128,33 @@ $(document).ready(function() { } } }); - gradStudentsTable.draw(); }); - // $('.graduated-checkbox').change(function() { - // let hasGraduated = $(this).is(':checked'); - // let username = $(this).data('username'); - // let routeUrl = hasGraduated ? "hasGraduated" : "hasNotGraduated"; - // let graduationURL = "/" + username + "/" + routeUrl + "/" - - // $.ajax({ - // type: "POST", - // url: graduationURL, - // success: function(response) { - // msgFlash("Graduation status updated successfully!", "success") - // console.log("Graduation status updated successfully!"); - // }, - // error: function(status, error) { - // msgFlash("Graduation status updated successfully!", "error") - // console.error("Error updating graduation status:", error); - // } - // }); - // }); - $('.graduated-checkbox').change(function() { let hasGraduated = $(this).is(':checked'); let username = $(this).data('username'); let routeUrl = hasGraduated ? "hasGraduated" : "hasNotGraduated"; let graduationURL = "/" + username + "/" + routeUrl + "/"; - var msgshown = $(this).data('msgshown') - - - - // console.log($(this).data('msgshown')) - - // $(this).data('msgshown','true'); - - - - // Reset the flag when the checkbox is changed $.ajax({ type: "POST", url: graduationURL, success: function(response) { + console.log("Graduation status updated successfully!"); + msgFlash("Graduation status updated successfully!", "success"); + console.log($('.alert').length); - console.log('success', msgshown) - - if ((msgshown == false )) { - - console.log($(this).data('msgshown')) - - $('#gradCheck').data('msgshown', true); + if ($('.alert').length > 1 ){ - // msgFlash("Graduation status updated successfully!", "success"); - console.log("Graduation status updated successfully!"); - msgFlash("Graduation status updated successfully!", "success"); - - MessageDelay() - - } + $('.alert').alert('close'); + }; + MessageDelay() }, error: function(status, error) { - // if (!messageDisplayed) { - // msgFlash("Error updating graduation status.", "error"); - // console.error("Error updating graduation status:", error); - // messageDisplayed = true; // Set the flag to true after displaying the message - // } + msgFlash("Error updating graduation status.", "error"); + console.error("Error updating graduation status:", error); + MessageDelay() } }); }); @@ -229,18 +186,11 @@ $('.graduated-checkbox').change(function() { function MessageDelay(){ - //for loop, close each message except for the last one - $('.alert').alert('close'); - - - - return setTimeout(ResetTimer,5000) + return setTimeout(FadeMessage,5000) } -function ResetTimer(){ - console.log($('.alert').length) - - $('.alert').fadeOut('fast'); - console.log("reset timer") - $('#gradCheck').data('msgshown',false); +function FadeMessage(){ + if ($('.alert').length > 0 ){ + $('.alert').fadeOut('fast'); + }; } \ No newline at end of file diff --git a/app/static/js/sidebar.js b/app/static/js/sidebar.js index 1ac368671..18e496318 100644 --- a/app/static/js/sidebar.js +++ b/app/static/js/sidebar.js @@ -1,5 +1,7 @@ $(document).ready(function() { + $('.alert').alert('close');// close excess flash messages from graduation managment + // fetch the number of interested students and unapproved courses and display them in the sidebar if there are any // and add hovers to describe what the numbers we are adding to the sidebar mean. $.ajax({ diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index cd268b3e1..aa48937da 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -69,7 +69,7 @@

Graduation Managment

- + From 2b405cfcf20b03358d96dba2b146c76819e5d469 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Thu, 7 Nov 2024 12:02:11 -0500 Subject: [PATCH 32/40] modified flash message in grad managment --- app/static/js/graduationManagement.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index e572afd96..7f6620dbc 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -141,14 +141,26 @@ $('.graduated-checkbox').change(function() { type: "POST", url: graduationURL, success: function(response) { - console.log("Graduation status updated successfully!"); - msgFlash("Graduation status updated successfully!", "success"); - console.log($('.alert').length); + // console.log("Graduation status updated successfully!"); + // msgFlash("Graduation status updated successfully!", "success"); + // console.log($('.alert').length); + + // console.log($('.alert').length); if ($('.alert').length > 1 ){ + + console.log($('.alert').length); + + // for ( let i = 0; i > $('.alert').length - 1; i++){ + // console.log('1'); + + // $('.alert').alert('close') + // } $('.alert').alert('close'); }; + console.log("Graduation status updated successfully!"); + msgFlash("Graduation status updated successfully!", "success"); MessageDelay() }, error: function(status, error) { From 8bc79601dae39cbe27561f45a4edead7078e405a Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Tue, 12 Nov 2024 09:48:37 -0500 Subject: [PATCH 33/40] moved cohort filter to the left, modified css file. --- app/static/css/graduationManagement.css | 14 +++++++++++++- app/templates/admin/graduationManagement.html | 6 ++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/static/css/graduationManagement.css b/app/static/css/graduationManagement.css index 24b601b60..35dae3826 100644 --- a/app/static/css/graduationManagement.css +++ b/app/static/css/graduationManagement.css @@ -7,6 +7,7 @@ .btn-group { margin-right: 10px; /* Space between the dropdown and the buttons */ + } h1 { @@ -21,4 +22,15 @@ h1 { .w-25{ margin-bottom: 50px; - } \ No newline at end of file + } + + +/* #cohortFilter{ + right: 200px; + +} */ + +#bongroup{ + right: 200px; + +} \ No newline at end of file diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index aa48937da..928c7b793 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -21,6 +21,8 @@ + + {% block app_content %}

Graduation Managment

@@ -35,8 +37,8 @@

Graduation Managment

CCE Minor -
-
-
- - -
+ + +
+ {{student.firstName}} {{student.lastName}} +
{{ user.firstName }} {{ user.lastName }}
- {{student.firstName}} {{student.lastName}} -
{{ user.firstName }} {{ user.lastName }} {{ user.classLevel }}
{{ user.firstName }} {{ user.lastName }} {{ user.classLevel }}
@@ -69,9 +64,9 @@

Graduation Managment

{% for user in users %} + - From 331b9063df71996f3ba99e2de4950cb92be2740c Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Fri, 15 Nov 2024 15:36:34 -0500 Subject: [PATCH 36/40] fixed the filter being passed through to the makegradstudentxls --- app/controllers/admin/graduationManagement.py | 8 ++++---- app/logic/graduationManagement.py | 8 ++++++++ app/static/js/graduationManagement.js | 7 +++---- app/templates/admin/graduationManagement.html | 2 +- database/tmp-backups/2024-11-15-backup.sql | 0 5 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 database/tmp-backups/2024-11-15-backup.sql diff --git a/app/controllers/admin/graduationManagement.py b/app/controllers/admin/graduationManagement.py index 25778b167..307320716 100644 --- a/app/controllers/admin/graduationManagement.py +++ b/app/controllers/admin/graduationManagement.py @@ -61,12 +61,12 @@ def hasNotGraduated(username): print(e) return "Error Updating Graduation Status", 500 -@admin_bp.route("/gradStudentsxls") -def gradsxls(): +@admin_bp.route("/gradStudentsxls/", methods=['GET']) +def gradsxls(filterType): if not g.current_user.isCeltsAdmin: abort(403) - - filterType = request.args.get('filterType', 'all') + print(filterType, '#####') + # filterType = request.args.get('filterType', 'all') newfile = makeGraduatedXls(filterType) return send_file(open(newfile, 'rb'), download_name='GraduatedStudents.xlsx', as_attachment=True) diff --git a/app/logic/graduationManagement.py b/app/logic/graduationManagement.py index 955142c93..afff6bc5b 100644 --- a/app/logic/graduationManagement.py +++ b/app/logic/graduationManagement.py @@ -47,6 +47,10 @@ def makeGraduatedXls(filterType): Returns: The file path and name to the newly created file, relative to the web root. """ + # filterType = "cce" + print('filtertype:' , filterType, "#####") + + CCEusers = getMinorProgress() bonnercohorts = getBonnerCohorts() @@ -77,10 +81,14 @@ def makeGraduatedXls(filterType): prev_year = student.year worksheet.write(row, 0, f"{student.year} - {student.year+1}", bold) + print('Bonner student found #####') + if filterType == 'cce': worksheet.write(row, 0, f"{student['firstName']} {student['lastName']}") + print('CCE student found #####') else: worksheet.write(row, 0, f"{student.firstName} {student.lastName}") + print(' (all) student found #####') row += 1 diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 7f6620dbc..14aa28d34 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -15,10 +15,9 @@ $(document).ready(function() { $('#main-filter').first().text(buttonText); $('#cohortFilter').text('Bonner Cohort'); - $('#selectAll').text('Select All'); - selectAllMode = true - $('#export').attr('href', `/gradStudentsxls?filterType=${filterType}`); + + $('#exportFile').attr('href', `/gradStudentsxls/${filterType}`); if (filterType === 'all') { gradStudentsTable.search('').draw(); @@ -90,7 +89,7 @@ $(document).ready(function() { }); gradStudentsTable.draw(); } - + console.log('Java Filter Type: ',filterType) }); $('.dropdown-item-new').click(function() { diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 4e4a7b5ad..982707c28 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -48,7 +48,7 @@

Graduation Managment

- + diff --git a/database/tmp-backups/2024-11-15-backup.sql b/database/tmp-backups/2024-11-15-backup.sql new file mode 100644 index 000000000..e69de29bb From ccc54eafe6e635a35b4342ccacd06ec410fa4bbe Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Tue, 3 Dec 2024 15:01:49 -0500 Subject: [PATCH 37/40] added some comments to gradmanagement.js and logic --- app/logic/graduationManagement.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/logic/graduationManagement.py b/app/logic/graduationManagement.py index afff6bc5b..e63bfce92 100644 --- a/app/logic/graduationManagement.py +++ b/app/logic/graduationManagement.py @@ -61,7 +61,7 @@ def makeGraduatedXls(filterType): worksheet.write('A1', 'Graduated Students', bold) worksheet.set_column('A:A', 20) - + prev_year = 1 row = 1 if filterType == 'all': @@ -69,7 +69,10 @@ def makeGraduatedXls(filterType): elif filterType == 'cce': students = [student for student in CCEusers if student['hasGraduated']] elif filterType == 'bonner': - students = BonnerCohort.select(BonnerCohort, User).join(User).where(User.hasGraduated == True) + # students = BonnerCohort.select(BonnerCohort, User).join(User).where(User.hasGraduated == True) + students = User.select(User.username).where(User.hasGraduated == True) + print('student list' , students , "#####") + print('bonner filter selected #####') elif filterType == 'bonnercohorts': students = [student for student in bonnercohorts if student['hasGraduated']] else: From 4b545c16977294249632eae0d5ba4f0a93122c55 Mon Sep 17 00:00:00 2001 From: Josh Wakin Date: Thu, 12 Dec 2024 15:27:33 -0500 Subject: [PATCH 38/40] Comment out the bonner filter portions of code in the graduationManagement.py and removed unneccessary comments and print statements --- app/logic/graduationManagement.py | 32 +++++++++++++++------------ app/static/js/graduationManagement.js | 14 ------------ 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/app/logic/graduationManagement.py b/app/logic/graduationManagement.py index e63bfce92..ee769041e 100644 --- a/app/logic/graduationManagement.py +++ b/app/logic/graduationManagement.py @@ -47,7 +47,7 @@ def makeGraduatedXls(filterType): Returns: The file path and name to the newly created file, relative to the web root. """ - # filterType = "cce" + print('filtertype:' , filterType, "#####") @@ -68,23 +68,27 @@ def makeGraduatedXls(filterType): students = User.select().where(User.hasGraduated == True) elif filterType == 'cce': students = [student for student in CCEusers if student['hasGraduated']] - elif filterType == 'bonner': - # students = BonnerCohort.select(BonnerCohort, User).join(User).where(User.hasGraduated == True) - students = User.select(User.username).where(User.hasGraduated == True) - print('student list' , students , "#####") - print('bonner filter selected #####') - elif filterType == 'bonnercohorts': - students = [student for student in bonnercohorts if student['hasGraduated']] + # elif filterType == 'bonner': + # students = BonnerCohort.select(BonnerCohort, User).join(User).where(User.hasGraduated == True) + + # print('##### Student list') + + # for name in User.select(User.username): + + # print(name) + + # print('##### Student list') + # print('bonner filter selected #####') + # elif filterType == 'bonnercohorts': + # students = [student for student in bonnercohorts if student['hasGraduated']] else: students = User.select() for student in students: - if filterType == 'bonner' and prev_year != student.year: - row += 1 - prev_year = student.year - worksheet.write(row, 0, f"{student.year} - {student.year+1}", bold) - - print('Bonner student found #####') + # if filterType == 'bonner' and prev_year != student.year: + # row += 1 + # prev_year = student.year + # worksheet.write(row, 0, f"{student.year} - {student.year+1}", bold) if filterType == 'cce': worksheet.write(row, 0, f"{student['firstName']} {student['lastName']}") diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index 14aa28d34..c69be879d 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -89,7 +89,6 @@ $(document).ready(function() { }); gradStudentsTable.draw(); } - console.log('Java Filter Type: ',filterType) }); $('.dropdown-item-new').click(function() { @@ -140,22 +139,9 @@ $('.graduated-checkbox').change(function() { type: "POST", url: graduationURL, success: function(response) { - // console.log("Graduation status updated successfully!"); - // msgFlash("Graduation status updated successfully!", "success"); - // console.log($('.alert').length); - - // console.log($('.alert').length); if ($('.alert').length > 1 ){ - console.log($('.alert').length); - - // for ( let i = 0; i > $('.alert').length - 1; i++){ - // console.log('1'); - - // $('.alert').alert('close') - // } - $('.alert').alert('close'); }; console.log("Graduation status updated successfully!"); From 5e7fe9190a0ce298cbb87835569a38ba1f15f733 Mon Sep 17 00:00:00 2001 From: drdoubleu <143204165+thealphagurlux@users.noreply.github.com> Date: Tue, 28 Jan 2025 17:28:25 -0500 Subject: [PATCH 39/40] Fixed alert message that pops up mulitple times when check boxs are ticked. --- app/static/js/graduationManagement.js | 2 +- app/templates/admin/graduationManagement.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/static/js/graduationManagement.js b/app/static/js/graduationManagement.js index c69be879d..99c18e77f 100644 --- a/app/static/js/graduationManagement.js +++ b/app/static/js/graduationManagement.js @@ -140,7 +140,7 @@ $('.graduated-checkbox').change(function() { url: graduationURL, success: function(response) { - if ($('.alert').length > 1 ){ + if ($('.alert').length >= 1 ){ $('.alert').alert('close'); }; diff --git a/app/templates/admin/graduationManagement.html b/app/templates/admin/graduationManagement.html index 982707c28..5818a477e 100644 --- a/app/templates/admin/graduationManagement.html +++ b/app/templates/admin/graduationManagement.html @@ -39,7 +39,7 @@

Graduation Managment

{{ user.firstName }} {{ user.lastName }} {{ user.classLevel }}