Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions app/controllers/main_routes/laborHistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,13 @@ def populateModal(statusKey):
currentUser = require_login()
if not currentUser: # Not logged in
return render_template('errors/403.html'), 403
forms = (FormHistory.select().join(LaborReleaseForm, join_type=JOIN.LEFT_OUTER)
.where(FormHistory.formID == statusKey).order_by(FormHistory.createdDate.desc(), FormHistory.formHistoryID.desc()))
forms = (FormHistory.select()
Comment thread
JohnCox2211 marked this conversation as resolved.
.join(LaborReleaseForm, join_type=JOIN.LEFT_OUTER)
.switch(FormHistory).join(OverloadForm, JOIN.LEFT_OUTER, on=(FormHistory.overloadForm == OverloadForm.overloadFormID))
.switch(OverloadForm).join(User, JOIN.LEFT_OUTER, on=(OverloadForm.laborApprover == User.userID))
Comment thread
JohnCox2211 marked this conversation as resolved.
Outdated
.switch(User).join(Supervisor, JOIN.LEFT_OUTER, on=(User.supervisor == Supervisor.ID))
.where(FormHistory.formID == statusKey)
.order_by(FormHistory.createdDate.desc(), FormHistory.formHistoryID.desc()))
statusForm = LaborStatusForm.get(LaborStatusForm.laborStatusFormID == statusKey)
currentDate = datetime.today()
pendingformType = None
Expand Down Expand Up @@ -166,10 +171,11 @@ def populateModal(statusKey):
form.adjustedForm.oldValue = oldPosition.POSN_TITLE + " (" + oldPosition.WLS+")"

if form.adjustedForm.fieldAdjusted == "department":
newDepartment = Department.get(Department.ORG == newValue)
oldDepartment = Department.get(Department.ORG == oldValue)
form.adjustedForm.newValue = newDepartment.DEPT_NAME
form.adjustedForm.oldValue = oldDepartment.DEPT_NAME
newDepartment = Department.get_or_none(Department.ORG == newValue)
oldDepartment = Department.get_or_none(Department.ORG == oldValue)
form.adjustedForm.newValue = newDepartment.DEPT_NAME if newDepartment else "Unknown " + newValue
form.adjustedForm.oldValue = oldDepartment.DEPT_NAME if oldDepartment else "Unknown " + oldValue
Comment thread
JohnCox2211 marked this conversation as resolved.


# Convert the field adjusted value out of camelcase into a more readable format
form.adjustedForm.fieldAdjusted = re.sub(r"(\w)([A-Z])", r"\1 \2", form.adjustedForm.fieldAdjusted).title()
Expand Down
10 changes: 7 additions & 3 deletions app/logic/allPendingForms.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ def checkAdjustment(allForms):
allForms.adjustedForm.oldValue = newPosition.POSN_TITLE

if allForms.adjustedForm.fieldAdjusted == "department":
newDepartment = Department.get(Department.ORG==allForms.adjustedForm.newValue)
allForms.adjustedForm.newValue = newDepartment.DEPT_NAME
allForms.adjustedForm.oldValue = newDepartment.ORG + "-" + newDepartment.ACCOUNT
newDepartment = Department.get_or_none(Department.ORG==allForms.adjustedForm.newValue)
if newDepartment:
allForms.adjustedForm.newValue = newDepartment.DEPT_NAME
allForms.adjustedForm.oldValue = newDepartment.ORG + "-" + newDepartment.ACCOUNT
else:
allForms.adjustedForm.newValue = "Unknown" + " - " + allForms.adjustedForm.newValue
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each value should be validated against the Department model independently so that one failure doesn't "poison" the label of the other.

allForms.adjustedForm.oldValue = "Unknown" + " - " + allForms.adjustedForm.oldValue
92 changes: 61 additions & 31 deletions app/templates/snips/studentHistoryModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@
<div class="col-sm-4" align="left">Submitted</div>
</div>
{% endif %}
{% endif %}

{% elif form.releaseForm != None %}
{% if form.releaseForm != None %}
{% if form.reviewedDate == None %}
<div class="h4 nopadding">
<div class="col-sm-3">{{form.createdDate.strftime('%m-%d-%Y')}}</div>
Expand Down Expand Up @@ -142,40 +143,43 @@
</div>
</div>
</div>
{% elif form.adjustedForm != None %}
{% if form.reviewedDate == None %}
<div class="h4 nopadding">
<div class="col-sm-3">{{form.createdDate.strftime('%m-%d-%Y')}}</div>
<div class="col-sm-5 ">{{form.historyType}}</div>
<div class="col-sm-4" align="left">Submitted</div>
</div>
{% elif form.reviewedDate != None %}
<div class="h4 nopadding">
<div class="col-sm-3">{{form.reviewedDate.strftime('%m-%d-%Y')}}</div>
<div class="col-sm-5 ">{{form.historyType}}</div>
<div class="col-sm-4" align="left">{{form.status}}</div>
</div>
{% if "Denied" in form.status.statusName %}
<div class="leftMargin">
<div class="row">
<p class="col-sm-4 pTag">Reject Reason:</p>
<div class="col-sm-7">
<textarea class="rejectReasonTextArea" rows="2" cols="45" readonly>{{form.rejectReason}}</textarea>
</div>
</div>
</div>
{% endif %}
<div class="h4 nopadding">
<div class="col-sm-3">{{form.createdDate.strftime('%m-%d-%Y')}}</div>
<div class="col-sm-5 ">{{form.historyType}}</div>
<div class="col-sm-4" align="left">Submitted</div>
</div>
{% endif %}

{% if form.adjustedForm != None %}
{% if form.reviewedDate == None %}
<div class="h4 nopadding">
<div class="col-sm-3">{{form.createdDate.strftime('%m-%d-%Y')}}</div>
<div class="col-sm-5 ">{{form.historyType}}</div>
<div class="col-sm-4" align="left">Submitted</div>
</div>
{% else %}
<div class="h4 nopadding">
<div class="col-sm-3">{{form.reviewedDate.strftime('%m-%d-%Y')}}</div>
<div class="col-sm-5 ">{{form.historyType}}</div>
<div class="col-sm-4" align="left">{{form.status}}</div>
</div>
{% if "Denied" in form.status.statusName %}
<div class="leftMargin">
<div class="row">
<p class="col-sm-4 pTag">Reject Reason:</p>
<div class="col-sm-7">
<textarea class="rejectReasonTextArea" rows="2" cols="45" readonly>{{form.rejectReason}}</textarea>
</div>
</div>
</div>
{% endif %}
<div class="h4 nopadding">
<div class="col-sm-3">{{form.createdDate.strftime('%m-%d-%Y')}}</div>
<div class="col-sm-5 ">{{form.historyType}}</div>
<div class="col-sm-4" align="left">Submitted</div>
</div>
{% endif %}
<div class="row">
<p class="col-sm-11 smallDataMargin pTag">{{form.adjustedForm.fieldAdjusted}} changed from {{form.adjustedForm.oldValue}} to {{form.adjustedForm.newValue}}</p>
</div>

{% elif form.overloadForm != None %}
{% endif %}

{% if form.overloadForm != None %}
{% if form.reviewedDate == None %}
<div class="h4 overloadBottom">
<div class="col-sm-3">{{form.createdDate.strftime('%m-%d-%Y')}}</div>
Expand Down Expand Up @@ -211,6 +215,32 @@
</div>
{% endif %}

<div class="smallDataMargin">
<div class="row" style="padding-top:5px">
<p class="col-sm-4 releaseTopRows pTag">Labor Office Contact:</p>
<div class="col-sm-7" align="left">
<p>
{% if form.overloadForm.laborApprover_id and (form.overloadForm.laborApprover.supervisor.FIRST_NAME or form.overloadForm.laborApprover.supervisor.LAST_NAME) %}
Comment thread
JohnCox2211 marked this conversation as resolved.
Outdated
{{form.overloadForm.laborApprover.supervisor.FIRST_NAME}} {{form.overloadForm.laborApprover.supervisor.LAST_NAME}}
{% else %}
None
{% endif %}
</p>
</div>
</div>
<div class="row">
<p class="col-sm-4 releaseTopRows pTag" align="left">Labor Review Date:</p>
<div class="col-sm-7" align="left">
<p>{{form.overloadForm.laborReviewDate.strftime('%m-%d-%Y') if form.overloadForm.laborReviewDate else "Not yet reviewed"}}</p>
</div>
</div>
<div class="row">
<p class="col-sm-4 bottomRows pTag">Reason for overload:</p>
<div class="col-sm-7" align="left">
<textarea class="overloadReasonTextArea" rows="2" cols="45" readonly>{{form.overloadForm.studentOverloadReason}}</textarea>
</div>
</div>
</div>
{% endif %}

{% endfor %}
Expand Down