diff --git a/app/controllers/admin_routes/allPendingForms.py b/app/controllers/admin_routes/allPendingForms.py index ef3499db2..4ac7332e0 100644 --- a/app/controllers/admin_routes/allPendingForms.py +++ b/app/controllers/admin_routes/allPendingForms.py @@ -210,7 +210,7 @@ def downloadAllPendingForms(): additionalSpreadsheetFields=additionalSpreadsheetFields ) - return send_file(excel.relativePath, as_attachment=True, attachment_filename=excel.relativePath.split('/').pop()) + return send_file(excel.relativePath, as_attachment=True, download_name=excel.relativePath.split('/').pop()) @admin.route('/admin/checkedForms', methods=['POST']) def approved_and_denied_Forms(): diff --git a/app/controllers/admin_routes/termManagement.py b/app/controllers/admin_routes/termManagement.py index 8a17d169f..04ee38676 100644 --- a/app/controllers/admin_routes/termManagement.py +++ b/app/controllers/admin_routes/termManagement.py @@ -115,22 +115,3 @@ def termStatusCheck(): except Exception as e: print(e) return jsonify({"Success": False}) - -@admin.route('/termManagement/manageEval', methods=['POST']) -def manageEval(): - try: - rsp = eval(request.data.decode("utf-8")) # This fixes byte indices must be integers or slices error - if rsp: - term = Term.get(rsp['evalBtn']) - if rsp["isMidyear"]: - term.isMidyearEvaluationOpen = not term.isMidyearEvaluationOpen - term.isFinalEvaluationOpen = False - else: - term.isFinalEvaluationOpen = not term.isFinalEvaluationOpen - term.isMidyearEvaluationOpen = False - term.save() - flasherInfo = {'termChanged': term.termName} - return jsonify(flasherInfo) - except Exception as e: - print(e) - return jsonify({}, 500) diff --git a/app/controllers/main_routes/laborHistory.py b/app/controllers/main_routes/laborHistory.py index de466929c..75a607dd5 100755 --- a/app/controllers/main_routes/laborHistory.py +++ b/app/controllers/main_routes/laborHistory.py @@ -117,9 +117,8 @@ def downloadFormHistory(): formSearchResults.searchType, requestedLSFs=formHistories, additionalSpreadsheetFields=[], - includeEvals=False ) - return send_file(excel.relativePath, mimetype='text/csv', as_attachment=True, attachment_filename=excel.relativePath.split('/').pop()) + return send_file(excel.relativePath, mimetype='text/csv', as_attachment=True, download_name=excel.relativePath.split('/').pop()) @main_bp.route('/laborHistory/modal/', methods=['GET']) def populateModal(statusKey): diff --git a/app/controllers/main_routes/main_routes.py b/app/controllers/main_routes/main_routes.py index b3af06c9e..d41bc246a 100755 --- a/app/controllers/main_routes/main_routes.py +++ b/app/controllers/main_routes/main_routes.py @@ -80,9 +80,8 @@ def downloadSupervisorPortalResults(): formSearchResults.searchType, requestedLSFs=formHistories, additionalSpreadsheetFields=[], - includeEvals=False ) - return send_file(excel.relativePath, as_attachment=True, attachment_filename=excel.relativePath.split('/').pop()) + return send_file(excel.relativePath, as_attachment=True, download_name=excel.relativePath.split('/').pop()) @main_bp.route('/supervisorPortal/liveSearch', methods=['GET']) def SupervisorPortalSearch(): diff --git a/app/controllers/main_routes/studentLaborEvaluation.py b/app/controllers/main_routes/studentLaborEvaluation.py deleted file mode 100644 index 1ca83af1b..000000000 --- a/app/controllers/main_routes/studentLaborEvaluation.py +++ /dev/null @@ -1,207 +0,0 @@ -from app.controllers.main_routes import * -from app.login_manager import * -import app.login_manager as login_manager -from flask import redirect, flash -from flask_wtf import FlaskForm -from wtforms import StringField, RadioField, TextAreaField, HiddenField, BooleanField -from wtforms.fields import IntegerRangeField -from wtforms.validators import DataRequired, Length -from app.models.formHistory import * -from app.models.studentLaborEvaluation import StudentLaborEvaluation -from werkzeug.exceptions import BadRequestKeyError -from app.logic.search import getDepartmentsForSupervisor -from datetime import date - -class SLEForm(FlaskForm): - - attendance = IntegerRangeField("Attendance", default = 15, render_kw={'class':'form-control slider'}) - attendanceComments = TextAreaField("Comments about attendance:", [Length(max=65535)], render_kw={'class':'form-control'}) - attendanceCommentsMidyear = TextAreaField("Attendance comments from Midyear :", render_kw={'class':'form-control', 'readonly': True}) - - accountability = IntegerRangeField("Accountability", default = 7, render_kw={'class':'form-control slider'}) - accountabilityComments = TextAreaField("Comments about accountability:", [Length(max=65535)], render_kw={'class':'form-control'}) - accountabilityCommentsMidyear = TextAreaField("Attendance comments from Midyear :", render_kw={'class':'form-control', 'readonly': True}) - - teamwork = IntegerRangeField("Teamwork", default = 7, render_kw={'class':'form-control slider'}) - teamworkComments = TextAreaField("Comments about teamwork:", [Length(max=65535)], render_kw={'class':'form-control'}) - teamworkCommentsMidyear = TextAreaField("Attendance comments from Midyear :", render_kw={'class':'form-control', 'readonly': True}) - - initiative = IntegerRangeField("Initiative", default = 7, render_kw={'class':'form-control slider'}) - initiativeComments = TextAreaField("Comments about initiative:", [Length(max=65535)], render_kw={'class':'form-control'}) - initiativeCommentsMidyear = TextAreaField("Attendance comments from Midyear :", render_kw={'class':'form-control', 'readonly': True}) - - respect = IntegerRangeField("Respect", default = 7, render_kw={'class':'form-control slider'}) - respectComments = TextAreaField("Comments about respect:", [Length(max=65535)], render_kw={'class':'form-control'}) - respectCommentsMidyear = TextAreaField("Attendance comments from Midyear :", render_kw={'class':'form-control', 'readonly': True}) - - learning = IntegerRangeField("Learning", default = 15, render_kw={'class':'form-control slider'}) - learningComments = TextAreaField("Comments about learning:", [Length(max=65535)], render_kw={'class':'form-control'}) - learningCommentsMidyear = TextAreaField("Attendance comments from Midyear :", render_kw={'class':'form-control', 'readonly': True}) - - jobSpecific = IntegerRangeField("Job Specific", default = 15, render_kw={'class':'form-control slider'}) - jobSpecificComments = TextAreaField("Comments about this job, specifically:", [Length(max=65535)], render_kw={'class':'form-control'}) - jobSpecificCommentsMidyear = TextAreaField("Attendance comments from Midyear :", render_kw={'class':'form-control', 'readonly': True}) - - transcriptComments = TextAreaField("Labor Transcript comments:", [Length(max=65535)], render_kw={'class':'form-control'}) - - isSubmitted = HiddenField('Is this a final submission', default = False) - - -@main_bp.route('/sle/', methods=['GET', 'POST']) -def sle(statusKey): - # NOTE: statusKey is the LSF id. Everything after this (template and controller) uses the associated laborHistory object/ID for this LSF id. - currentUser = require_login() - - laborHistoryForm = FormHistory.select().where((FormHistory.formID == int(statusKey))).where(FormHistory.historyType == "Labor Status Form")[-1] - if request.form.get("resetConfirmation"): - # Delete the most recently submitted evaluation for this formhistory - newest = (StudentLaborEvaluation.select() - .where(StudentLaborEvaluation.formHistoryID == laborHistoryForm.formHistoryID) - .order_by(StudentLaborEvaluation.date_submitted.desc(nulls="LAST"), StudentLaborEvaluation.ID.desc()) - ).get() - if newest: - newest.delete_instance() - - return redirect("/sle/" + str(laborHistoryForm.formID.laborStatusFormID)) - - if currentUser.student and currentUser.student.ID != laborHistoryForm.formID.studentSupervisee.ID: - # current user is not the student - return render_template('errors/403.html'), 403 - - elif not currentUser.isLaborAdmin and laborHistoryForm.formID.supervisor.DEPT_NAME not in [dept.DEPT_NAME for dept in getDepartmentsForSupervisor(currentUser)]: - # current user is not in the same dept as the lsf supervisor - return render_template('errors/403.html'), 403 - - sleForm = SLEForm() - existing_final_evaluation = StudentLaborEvaluation.get_or_none(formHistoryID = laborHistoryForm, is_midyear_evaluation = False, is_submitted = True) - existing_midyear_evaluation = StudentLaborEvaluation.get_or_none(formHistoryID = laborHistoryForm, is_midyear_evaluation = True, is_submitted = True) - existing_saved_evaluation = StudentLaborEvaluation.select().where(StudentLaborEvaluation.formHistoryID == laborHistoryForm, StudentLaborEvaluation.is_submitted == False) - if existing_saved_evaluation: - existing_saved_evaluation = existing_saved_evaluation[-1] - - if not request.method == "POST": # Doesn't override submitted POST data! - if existing_midyear_evaluation: # TODO Or there's savedforlater data - sleForm.attendance.data = existing_midyear_evaluation.attendance_score - sleForm.accountability.data = existing_midyear_evaluation.accountability_score - sleForm.teamwork.data = existing_midyear_evaluation.teamwork_score - sleForm.initiative.data = existing_midyear_evaluation.initiative_score - sleForm.respect.data = existing_midyear_evaluation.respect_score - sleForm.learning.data = existing_midyear_evaluation.learning_score - sleForm.jobSpecific.data = existing_midyear_evaluation.jobSpecific_score - - sleForm.attendanceCommentsMidyear.data = "Midyear comments: \n" + existing_midyear_evaluation.attendance_comment - sleForm.accountabilityCommentsMidyear.data = "Midyear comments: \n" + existing_midyear_evaluation.accountability_comment - sleForm.teamworkCommentsMidyear.data = "Midyear comments: \n" + existing_midyear_evaluation.teamwork_comment - sleForm.initiativeCommentsMidyear.data = "Midyear comments: \n" + existing_midyear_evaluation.initiative_comment - sleForm.respectCommentsMidyear.data = "Midyear comments: \n" + existing_midyear_evaluation.respect_comment - sleForm.learningCommentsMidyear.data = "Midyear comments: \n" + existing_midyear_evaluation.learning_comment - sleForm.jobSpecificCommentsMidyear.data = "Midyear comments: \n" + existing_midyear_evaluation.jobSpecific_comment - - if existing_saved_evaluation: - sleForm.attendance.data = existing_saved_evaluation.attendance_score - sleForm.accountability.data = existing_saved_evaluation.accountability_score - sleForm.teamwork.data = existing_saved_evaluation.teamwork_score - sleForm.initiative.data = existing_saved_evaluation.initiative_score - sleForm.respect.data = existing_saved_evaluation.respect_score - sleForm.learning.data = existing_saved_evaluation.learning_score - sleForm.jobSpecific.data = existing_saved_evaluation.jobSpecific_score - - sleForm.attendanceComments.data = existing_saved_evaluation.attendance_comment - sleForm.accountabilityComments.data = existing_saved_evaluation.accountability_comment - sleForm.teamworkComments.data = existing_saved_evaluation.teamwork_comment - sleForm.initiativeComments.data = existing_saved_evaluation.initiative_comment - sleForm.respectComments.data = existing_saved_evaluation.respect_comment - sleForm.learningComments.data = existing_saved_evaluation.learning_comment - sleForm.jobSpecificComments.data = existing_saved_evaluation.jobSpecific_comment - sleForm.transcriptComments.data = existing_saved_evaluation.transcript_comment - - - if not (laborHistoryForm.formID.termCode.isFinalEvaluationOpen or laborHistoryForm.formID.termCode.isMidyearEvaluationOpen) and not existing_final_evaluation and not existing_midyear_evaluation: - return render_template('errors/403.html'), 403 - - overall_score = 73 # The default value - if existing_final_evaluation: - overall_score = (existing_final_evaluation.attendance_score + - existing_final_evaluation.accountability_score + - existing_final_evaluation.teamwork_score + - existing_final_evaluation.initiative_score + - existing_final_evaluation.respect_score + - existing_final_evaluation.learning_score + - existing_final_evaluation.jobSpecific_score) - elif existing_midyear_evaluation: - overall_score = (existing_midyear_evaluation.attendance_score + - existing_midyear_evaluation.accountability_score + - existing_midyear_evaluation.teamwork_score + - existing_midyear_evaluation.initiative_score + - existing_midyear_evaluation.respect_score + - existing_midyear_evaluation.learning_score + - existing_midyear_evaluation.jobSpecific_score) - - if sleForm.validate_on_submit(): - # Handling Booleanfields are tricky... - try: - submitAsFinal = True if request.form["submit_as_final"] else False - except BadRequestKeyError: - submitAsFinal = False - - # First delete any temporarily saved data (is_submitted = False) - if not laborHistoryForm.formID.termCode.isMidyearEvaluationOpen: # Final eval - is_midyear_evaluation = False - elif submitAsFinal: # Midyear submitted as final - is_midyear_evaluation = False - else: # Midyear - is_midyear_evaluation = True - try: - sle = StudentLaborEvaluation.get(formHistoryID = laborHistoryForm, is_submitted = False, is_midyear_evaluation = is_midyear_evaluation) - sle.delete_instance() - except DoesNotExist: - pass - # Then, save the new record - studentLaborEvaluation = StudentLaborEvaluation.create( - formHistoryID = laborHistoryForm, - attendance_score = sleForm.attendance.data, - attendance_comment = sleForm.attendanceComments.data, - accountability_score = sleForm.accountability.data, - accountability_comment = sleForm.accountabilityComments.data, - teamwork_score = sleForm.teamwork.data, - teamwork_comment = sleForm.teamworkComments.data, - initiative_score = sleForm.initiative.data, - initiative_comment = sleForm.initiativeComments.data, - respect_score = sleForm.respect.data, - respect_comment = sleForm.respectComments.data, - learning_score = sleForm.learning.data, - learning_comment = sleForm.learningComments.data, - jobSpecific_score = sleForm.jobSpecific.data, - jobSpecific_comment = sleForm.jobSpecificComments.data, - transcript_comment = sleForm.transcriptComments.data, - is_submitted = True if sleForm.isSubmitted.data == "True" else False, - submitted_by = currentUser, - date_submitted = date.today() - ) - if laborHistoryForm.formID.termCode.isMidyearEvaluationOpen and not submitAsFinal: - studentLaborEvaluation.is_midyear_evaluation = True - studentLaborEvaluation.save() - # Use first and last (so preferred name works) - msg = f"Thank you for submitting a labor evaluation for {laborHistoryForm.formID.studentSupervisee.FIRST_NAME} {laborHistoryForm.formID.studentSupervisee.LAST_NAME}!" - flash(msg, "success") - return redirect("/") - - if laborHistoryForm.status.statusName != "Approved": - # Only approved evaluations get an SLE, so send them home. - return redirect("/") - - if existing_final_evaluation and existing_final_evaluation.date_submitted: - submittedDate = existing_final_evaluation.date_submitted.strftime("%m-%d-%Y") - else: - submittedDate = None - - return render_template("main/studentLaborEvaluation.html", - form = sleForm, - laborHistoryForm = laborHistoryForm, - existing_final_evaluation = existing_final_evaluation, - existing_midyear_evaluation = existing_midyear_evaluation, - date_submitted = submittedDate, - overall_score = overall_score, - isFinalEvaluationOpen = laborHistoryForm.formID.termCode.isFinalEvaluationOpen, - currentUser = currentUser - ) diff --git a/app/logic/download.py b/app/logic/download.py index b9532446d..4717aa746 100644 --- a/app/logic/download.py +++ b/app/logic/download.py @@ -32,18 +32,17 @@ class CSVMaker: ''' Create the CSV for the download bottons ''' - def __init__(self, downloadName, requestedLSFs: ModelSelect, includeEvals = False, additionalSpreadsheetFields: list[str] = []): + def __init__(self, downloadName, requestedLSFs: ModelSelect, additionalSpreadsheetFields: list[str] = []): self.relativePath = f'static/files/{downloadName}.csv' self.completePath = 'app/' + self.relativePath self.additionalSpreadsheetFields = (self._validateAdditionalSpreadsheetFields(additionalSpreadsheetFields)) self.formHistories = requestedLSFs - self.includeEvals = includeEvals self.makeCSV() @staticmethod def _validateAdditionalSpreadsheetFields(additionalFields): for additionalField in additionalFields: - if additionalField not in {'overloads', 'finalEvaluations', 'midYearEvaluations', 'allEvaluations'}: + if additionalField not in {'overloads', 'allEvaluations'}: raise ValueError(f'Invalid spreadsheet fields: {additionalField}') return additionalFields @@ -74,24 +73,6 @@ def makeCSV(self): 'Supervisor Email', 'Supervisor Notes' ]) - if self.includeEvals: - headers.extend(['SLE Type', - 'SLE Attendance', - 'SLE Attendance Comments', - 'SLE Accountability', - 'SLE Accountability Comments', - 'SLE Teamwork', - 'SLE Teamwork Comments', - 'SLE Initiative', - 'SLE Initiative Comments', - 'SLE Respect', - 'SLE Respect Comments', - 'SLE Learning', - 'SLE Learning Comments', - 'SLE Job Specific', - 'SLE Job Specific Comments', - 'SLE Overall Score' - ]) if 'overloads' in self.additionalSpreadsheetFields: headers.extend(['Student Overload Reason', @@ -109,22 +90,7 @@ def makeCSV(self): for form in self.formHistories: row = self.addPrimaryData(form) - if self.includeEvals: - evalRows = self.addEvaluationData(form.formHistoryID) - if len(evalRows) == 0: - self.filewriter.writerow(row) - elif len(evalRows) == 1: - row.extend(evalRows[0]) - self.filewriter.writerow(row) - else: - row.extend(evalRows[0]) - self.filewriter.writerow(row) - for evaluation in evalRows[1:]: - row = [""] * 17 - row.extend(evaluation) - self.filewriter.writerow(row) - - elif 'overloads' in self.additionalSpreadsheetFields: + if 'overloads' in self.additionalSpreadsheetFields: row = self.addOverloadData(form, row) self.filewriter.writerow(row) else: @@ -178,57 +144,4 @@ def addOverloadData(self, form, rowData): return rowData - - def addEvaluationData(self, formID): - ''' - Adds data for SLE - ''' - multipleRows = [] - if "finalEvaluations" in self.additionalSpreadsheetFields: - finalEvaluation = StudentLaborEvaluation.get_or_none(StudentLaborEvaluation.formHistoryID == formID, StudentLaborEvaluation.is_midyear_evaluation == 0, StudentLaborEvaluation.is_submitted == True) - if finalEvaluation: - multipleRows.append(self.insertEvaluationData(finalEvaluation, "Final")) - elif "midYearEvaluations" in self.additionalSpreadsheetFields: - midyearEvaluation = StudentLaborEvaluation.get_or_none(StudentLaborEvaluation.formHistoryID == formID, StudentLaborEvaluation.is_midyear_evaluation == 1, StudentLaborEvaluation.is_submitted == True) - if midyearEvaluation: - multipleRows.append(self.insertEvaluationData(midyearEvaluation, "Midyear")) - elif self.includeEvals == True: - anyEvaluation = StudentLaborEvaluation.select().where(StudentLaborEvaluation.formHistoryID == formID, StudentLaborEvaluation.is_submitted == True) - if anyEvaluation: - for evaluation in anyEvaluation: - multipleRows.append(self.insertEvaluationData(evaluation, "Midyear" if evaluation.is_midyear_evaluation else "Final")) - else: - return [] - - return multipleRows - - def insertEvaluationData(self, evaluation, evalType): - ''' - Helper function for self.addEvaluationData(); Adds individual row's SLE data - ''' - tableRow = [] - tableRow.extend([ evalType, - evaluation.attendance_score, - evaluation.attendance_comment, - evaluation.accountability_score, - evaluation.accountability_comment, - evaluation.teamwork_score, - evaluation.teamwork_comment, - evaluation.initiative_score, - evaluation.initiative_comment, - evaluation.respect_score, - evaluation.respect_comment, - evaluation.learning_score, - evaluation.learning_comment, - evaluation.jobSpecific_score, - evaluation.jobSpecific_comment - ]) - tableRow.append(evaluation.attendance_score + - evaluation.accountability_score + - evaluation.teamwork_score + - evaluation.initiative_score + - evaluation.respect_score + - evaluation.learning_score + - evaluation.jobSpecific_score - ) - return tableRow + \ No newline at end of file diff --git a/app/static/js/studentLaborEvaluation.js b/app/static/js/studentLaborEvaluation.js index 455eab37f..f955cbb71 100644 --- a/app/static/js/studentLaborEvaluation.js +++ b/app/static/js/studentLaborEvaluation.js @@ -79,12 +79,3 @@ function update_sum() { $("#finalSubmitButton").click(function() { $("#isSubmitted").val("True"); }); - -$('#submit_as_final').change(function() { - if (this.checked) { - $("#transcriptComments").attr("disabled", false); - } else { - $("#transcriptComments").attr("disabled", true); - $("#transcriptComments").val(null); - } -}) diff --git a/app/static/js/termManagement.js b/app/static/js/termManagement.js index 2d4d2c469..238a9a1fe 100755 --- a/app/static/js/termManagement.js +++ b/app/static/js/termManagement.js @@ -125,44 +125,4 @@ function termStatus(term) { $("#flasher").delay(5000).fadeOut(); } }) -}; - -function toggleEval(term, isMidyear) { - if (isMidyear) { - var clickedBtn = $("#midyear_eval_btn_" + term); - var otherBtn = $("#eval_btn_" + term); - } else { - var clickedBtn = $("#eval_btn_" + term); - var otherBtn = $("#midyear_eval_btn_" + term); - } - - $.ajax({ - method: "POST", - url: "/termManagement/manageEval", - dataType: "json", - contentType: "application/json", - data: JSON.stringify({"evalBtn": term, "isMidyear": isMidyear}), - processData: false, - success: function(response) { - otherBtn.removeClass("btn-success").addClass("btn-danger").text("Closed"); - if($(clickedBtn).hasClass("btn-success")) { - $(clickedBtn).removeClass("btn-success"); - $(clickedBtn).addClass("btn-danger"); - $(clickedBtn).text("Closed"); - category = "danger"; - state = "'Closed'."; - } - else { - $(clickedBtn).removeClass("btn-danger"); - $(clickedBtn).addClass("btn-success"); - $(clickedBtn).text("Open"); - category = "success"; - state = "'Open'."; - } - term = response['termChanged'] - message = "The "+ (isMidyear ? "midyear ":"final ") +"evaluations for "+ term +' is set to '+ state - $("#flash_container").html(''); - $("#flasher").delay(5000).fadeOut(); - } - }); -} +}; \ No newline at end of file diff --git a/app/templates/admin/termManagement.html b/app/templates/admin/termManagement.html index 05bac23e3..64ad9ba5c 100755 --- a/app/templates/admin/termManagement.html +++ b/app/templates/admin/termManagement.html @@ -72,15 +72,6 @@

class="glyphicon glyphicon-bookmark" tabindex="0"> - - Evaluations
(Midyear | Final) - - - @@ -166,33 +157,6 @@

onclick="termStatus({{term.termCode}})" value="{{term.termState}}">{% if term.termState == True %} Open {% elif term.termState == False %} Closed {% endif %} - - -
- {% if (term.termCode|string)[-2:] == "00" %} - - {% endif %} - {% if (term.termCode|string)[-2:] == "00" or (term.termCode|string)[-2:] == "13" %} {# AY and Summer only #} - - {% endif %} -
- {% endfor %} @@ -202,4 +166,4 @@

{% endfor %} -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/app/templates/main/studentLaborEvaluation.html b/app/templates/main/studentLaborEvaluation.html deleted file mode 100644 index 269fa95ce..000000000 --- a/app/templates/main/studentLaborEvaluation.html +++ /dev/null @@ -1,529 +0,0 @@ -{% extends "base.html" %} -{% block scripts %} - {{super()}} - - -{% endblock %} - -{% block styles %} - {{super()}} - -{% endblock %} - -{% block app_content %} - -
- - Click to Skip - - -

Student Labor Evaluation - {{laborHistoryForm.formID.studentSupervisee.FIRST_NAME}} {{laborHistoryForm.formID.studentSupervisee.LAST_NAME}}

-
- -
-
-
- {{ form.csrf_token }} -
-
-
-
Department:
-
{{laborHistoryForm.formID.department.DEPT_NAME}}
-
Supervisor:
-
{{laborHistoryForm.formID.supervisor.FIRST_NAME}} {{laborHistoryForm.formID.supervisor.LAST_NAME}}
-
Student:
-
{{laborHistoryForm.formID.studentSupervisee.FIRST_NAME}} {{laborHistoryForm.formID.studentSupervisee.LAST_NAME}}
-
-
-
-
-
Term:
-
{{laborHistoryForm.formID.termCode.termName}}
-
Job Type (hours):
-
{{laborHistoryForm.formID.jobType}} ({{laborHistoryForm.formID.weeklyHours}})
-
Position (WLS):
-
{{laborHistoryForm.formID.POSN_TITLE}} ({{laborHistoryForm.formID.WLS}})
- {% if existing_final_evaluation %} -
Date Submitted:
-
{{existing_final_evaluation.date_submitted}}
- {% endif %} -
-
-
- {% if laborHistoryForm.formID.supervisor != currentUser.supervisor %} -
- WARNING: According to the system, you are not this student's supervisor. Do not complete this evaluation unless you have {{laborHistoryForm.formID.supervisor.FIRST_NAME}} {{laborHistoryForm.formID.supervisor.LAST_NAME}}'s permission! -
- {% endif %} -
- - - - {# begin attendance #} -

{{ form.attendance.label }} - -

-
-
- {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{ form.attendance(**{"min":1, "max":20}) }} - {% endif %} -
-

- {% if existing_final_evaluation %} - {{existing_final_evaluation.attendance_score}}/20 - {% else %} - {{form.attendance.data}} - {% endif %} -

-
- -
-
- {{form.attendanceComments.label}} - {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{form.attendanceComments}} - {% endif %} - {% if existing_midyear_evaluation and not existing_final_evaluation %} - {{form.attendanceCommentsMidyear}} - {% else %} -

{{existing_final_evaluation.attendance_comment}}

- {% endif %} -
- {% if form.attendanceComments.errors %} - - {% endif %} -
-
- -
-
- {# end attendance #} - - {# begin accountability #} -

{{ form.accountability.label }} - -

-
-
- {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{ form.accountability(**{"min":1, "max":10}) }} - {% endif %} -
-

- {% if existing_final_evaluation %} - {{existing_final_evaluation.accountability_score}}/10 - {% else %} - {{form.accountability.data}} - {% endif %} -

-
- -
-
- {{form.accountabilityComments.label}} - {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{form.accountabilityComments}} - {% endif %} - {% if existing_midyear_evaluation and not existing_final_evaluation %} - {{form.accountabilityCommentsMidyear}} - {% else %} -

{{existing_final_evaluation.accountability_comment}}

- {% endif %} -
- {% if form.accountabilityComments.errors %} - - {% endif %} -
-
- -
-
- {# end accountability #} - - {# begin teamwork #} -

{{ form.teamwork.label }} - -

-
-
- {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{ form.teamwork(**{"min":1, "max":10}) }} - {% endif %} -
-

- {% if existing_final_evaluation %} - {{existing_final_evaluation.teamwork_score}}/10 - {% else %} - {{form.teamwork.data}} - {% endif %} -

-
- -
-
- {{form.teamworkComments.label}} - {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{form.teamworkComments}} - {% endif %} - {% if existing_midyear_evaluation and not existing_final_evaluation %} - {{form.teamworkCommentsMidyear}} - {% else %} -

{{existing_final_evaluation.teamwork_comment}}

- {% endif %} -
- {% if form.teamworkComments.errors %} - - {% endif %} -
-
-
-
- {# end teamwork #} - - {# begin initiative #} -

{{ form.initiative.label }} - -

-
-
- {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{ form.initiative(**{"min":1, "max":10}) }} - {% endif %} -
-

- {% if existing_final_evaluation %} - {{existing_final_evaluation.initiative_score}}/10 - {% else %} - {{form.initiative.data}} - {% endif %} -

-
- -
-
- {{form.initiativeComments.label}} - {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{form.initiativeComments}} - {% endif %} - {% if existing_midyear_evaluation and not existing_final_evaluation %} - {{form.initiativeCommentsMidyear}} - {% else %} -

{{existing_final_evaluation.initiative_comment}}

- {% endif %} -
- {% if form.initiativeComments.errors %} - - {% endif %} -
-
-
-
- {# end initiative #} - - {# begin respect #} -

{{ form.respect.label }} - -

-
-
- {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{ form.respect(**{"min":1, "max":10}) }} - {% endif %} -
-

- {% if existing_final_evaluation %} - {{existing_final_evaluation.respect_score}}/10 - {% else %} - {{form.respect.data}} - {% endif %} -

-
- -
-
- {{form.respectComments.label}} - {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{form.respectComments}} - {% endif %} - {% if existing_midyear_evaluation and not existing_final_evaluation %} - {{form.respectCommentsMidyear}} - {% else %} -

{{existing_final_evaluation.respect_comment}}

- {% endif %} -
- {% if form.respectComments.errors %} - - {% endif %} -
-
-
-
- {# end respect #} - - {# begin learning #} -

{{ form.learning.label }} - -

-
-
- {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{ form.learning(**{"min":1, "max":20}) }} - {% endif %} -
-

- {% if existing_final_evaluation %} - {{existing_final_evaluation.learning_score}}/20 - {% else %} - {{form.learning.data}} - {% endif %} -

-
- -
-
- {{form.learningComments.label}} - {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{form.learningComments}} - {% endif %} - {% if existing_midyear_evaluation and not existing_final_evaluation %} - {{form.learningCommentsMidyear}} - {% else %} -

{{existing_final_evaluation.learning_comment}}

- {% endif %} -
- {% if form.learningComments.errors %} - - {% endif %} -
-
-
-
- {# end learning #} - - {# begin jobSpecific #} -

{{ form.jobSpecific.label }} - -

-
-
- {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{ form.jobSpecific(**{"min":1, "max":20}) }} - {% endif %} -
-

- {% if existing_final_evaluation %} - {{existing_final_evaluation.jobSpecific_score}}/20 - {% else %} - {{form.jobSpecific.data}} - {% endif %} -

-
- -
-
- {{form.jobSpecificComments.label}} - {% if not existing_final_evaluation and not (existing_midyear_evaluation and not isFinalEvaluationOpen) %} - {{form.jobSpecificComments}} - {% endif %} - {% if existing_midyear_evaluation and not existing_final_evaluation %} - {{form.jobSpecificCommentsMidyear}} - {% else %} -

{{existing_final_evaluation.jobSpecific_comment}}

- {% endif %} -
- {% if form.jobSpecificComments.errors %} - - {% endif %} -
-
-
-
- {# end jobSpecific #} - - {# begin transcript #} -

{{ form.transcriptComments.label }} - -

-
-
-
-
- {{form.transcriptComments.label}} - {% if existing_final_evaluation %} -

{{existing_final_evaluation.transcript_comment}}

- {% else %} - {{form.transcriptComments}} - {% endif %} -
- {% if form.transcriptComments.errors %} - - {% endif %} -
-
-
-
- {#{% endif %}#} - {# end transcript #} - - {# begin final #} -
-
-
-

- {{laborHistoryForm.formID.studentSupervisee.FIRST_NAME}}'s Overall Score:
- {{overall_score}}
- -

- -
- {% if not existing_final_evaluation and (not existing_midyear_evaluation or isFinalEvaluationOpen) %} - {{form.isSubmitted}} -
- {% if not isFinalEvaluationOpen %} -
- -
- {% endif %} -
- - -
-
- {% else %} -
-
- -
- {% endif %} -
- {% include "snips/resetConfirmationModal.html" %} - -
-
-
- - -{% endblock %} diff --git a/requirements.txt b/requirements.txt index 0549a2235..643b6770e 100755 --- a/requirements.txt +++ b/requirements.txt @@ -91,4 +91,4 @@ wheel==0.46.3 wsproto==1.3.2 WTForms==3.2.1 xlsxwriter==3.2.9 -zipp==3.23.0 +zipp==3.23.0 \ No newline at end of file diff --git a/tests/code/test_apiEndpoint.py b/tests/code/test_apiEndpoint.py index 4cc41aa6e..c211f67b2 100644 --- a/tests/code/test_apiEndpoint.py +++ b/tests/code/test_apiEndpoint.py @@ -47,9 +47,7 @@ def test_getLaborInformation(): termState = 1, isBreak = 0, isSummer = 0, - isAcademicyear = 0, - isFinalEvaluationOpen = 0, - isMidyearEvaluationOpen = 0) + isAcademicYear = 0) testLaborForm = LaborStatusForm.create(termCode_id = 202100, studentSupervisee_id = "B00841417", diff --git a/tests/code/test_studentEvaluation.py b/tests/code/test_studentEvaluation.py deleted file mode 100644 index d2dd287e0..000000000 --- a/tests/code/test_studentEvaluation.py +++ /dev/null @@ -1,109 +0,0 @@ -import pytest -from app.controllers.main_routes.studentLaborEvaluation import sle -from app import app -from flask_wtf.csrf import CSRFProtect -import pytest -from app.models import mainDB -from app.models.laborStatusForm import LaborStatusForm -from app.models.department import Department -from app.models.term import Term -from app.models.formHistory import FormHistory -from app.models.student import Student -from app.models.supervisor import Supervisor -from app.models.user import User -from app.logic.statusFormFunctions import createLaborStatusForm -from app.models.studentLaborEvaluation import StudentLaborEvaluation -import json - - -@pytest.mark.integration -def testCreateStudentEval(): - with mainDB.atomic() as transaction: - testingDept = Department.create(DEPT_NAME="Computer Science", ACCOUNT="6740", ORG="2114") - testingTerm = (Term.create(termCode = 200000, - termName = "Testing Term", - termStart="2022-08-01", termEnd="2022-05-01", - primaryCutOff="2022-09-01", adjustedCutOff="2022-09-01", - termState=1, - isBreak=0, - isSummer=0, - isAcademicYear=0, - isFinalEvaluationOpen=1)) - - testingStudent = (Student.create( - ID="B00000002", - legal_name="Tyler", - LAST_NAME="Parton", - STU_EMAIL="partont@whatever.edu", - STU_CPO="Unknown" - )) - testingSupervisor = Supervisor.create(ID = "B00000001", - PIDM = 75, - legal_name = "Not", - LAST_NAME = "Scott", - EMAIL = "None", - CPO = "None", - DEPT_NAME = "Computer Science") - - - testingLSF = LaborStatusForm.create(studentName = "Tyler Parton", - termCode = 200000, - studentSupervisee = "B00000002", - supervisor = "B00000001", - department = testingDept.departmentID, - jobType = "Primary", - WLS = "1", - POSN_TITLE = "Student Programmer", - POSN_CODE = "S61407") - - testUser = User.create(student = None, - supervisor = testingSupervisor.ID, - username = "scottn", - isLaborAdmin = None, - isFinancialAidAdmin = None, - isSaasAdmin = None) - - - testingFormHistory = (FormHistory.create(formID = testingLSF.laborStatusFormID, - historyType = "Labor Status Form", - releaseForm = None, - adjustedForm = None, - overloadForm = None, - createdBy = testUser.userID, - createdDate = "2020-04-14", - reviewedDate = "2020-04-14", - reviewedBy = None, - status = "Approved")) - - testCreation = {"isSubmitted": True, - "submit_as_final": True, - "attendance": 15, - "accountability": 7, - "teamwork": 7, - "initiative": 7, - "respect": 7, - "learning": 15, - "jobSpecific": 15, - "attendanceComments": " ", - "teamworkComments": " ", - "initiativeComments": " ", - "respectComments": " ", - "accountabilityComments": " ", - "learningComments": " ", - "jobSpecificComments": " ", - "transcriptComments": " "} - - testReset = {"resetConfirmation": True} - - with app.test_request_context( "/sle", method="POST", data=testCreation): - app.config['WTF_CSRF_ENABLED'] = False - app.config['show_queries'] = False - createSLEform = sle(testingLSF.laborStatusFormID) - assert StudentLaborEvaluation.get_or_none(StudentLaborEvaluation.formHistoryID == testingFormHistory.formHistoryID) != None - - with app.test_request_context( "/sle", method="POST", data=testReset): - app.config['WTF_CSRF_ENABLED'] = False - app.config['show_queries'] = False - createSLEform = sle(testingLSF.laborStatusFormID) - assert StudentLaborEvaluation.get_or_none(StudentLaborEvaluation.formHistoryID == testingFormHistory.formHistoryID) == None - transaction.rollback()