Skip to content

Commit ab8de09

Browse files
committed
e Please enter the commit message for your changes. Lines starting
1 parent 7ccce94 commit ab8de09

8 files changed

Lines changed: 190 additions & 131 deletions

File tree

app/controllers/main_routes/alterLSF.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def alterLSF(laborStatusKey):
2626
if not currentUser.isLaborAdmin: # Not an admin
2727
if currentUser.student and not currentUser.supervisor: # If a student is logged in and trying to get to this URL then send them back to their own page.
2828
return redirect("/laborHistory/" + currentUser.student.ID)
29-
3029
currentDate = date.today()
3130
#If logged in....
3231
#Step 1: get form attached to the student (via labor history modal)
@@ -71,8 +70,7 @@ def alterLSF(laborStatusKey):
7170
(Department.ORG == form.department.ORG)
7271
)
7372
)
74-
positions = [position for position in positions]
75-
positions = set(positions)
73+
positions = {position for position in positions}
7674
departments = Department.select()
7775
# supervisors from the old system WILL have a Supervisor record, but might not have a Tracy record
7876
oldSupervisor = Supervisor.get_or_none(ID = form.supervisor.ID)

app/controllers/main_routes/laborHistory.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ def populateModal(statusKey):
127127
to create the modal, and append all of the data gathered here form the database to the modal. It also sets a button state which decides which buttons
128128
to put on the modal depending on what form is in the history.
129129
"""
130-
print("Status Key: ", statusKey)
131130
try:
132131
currentUser = require_login()
133132
if not currentUser: # Not logged in
@@ -161,7 +160,6 @@ def populateModal(statusKey):
161160
.where(LaborStatusForm.POSN_CODE == newValue)
162161
.first()
163162
)
164-
print("wewewe", oldValue, "lolo")
165163
try:
166164
oldPosition = LaborStatusForm.get_or_none(
167165
LaborStatusForm.POSN_CODE == oldValue

app/controllers/main_routes/laborStatusForm.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,24 +118,21 @@ def getDates(termcode):
118118
def getPositions(departmentOrg, departmentAcct):
119119
""" Get all of the positions that are in the selected department """
120120
currentUser = require_login()
121-
print("ikikik", departmentAcct, "fefefe", departmentOrg, "lili")
122-
positions = (
123-
FormHistory
121+
positions = set(
122+
LaborStatusForm
124123
.select(FormHistory, LaborStatusForm, Department)
125-
.join(LaborStatusForm, on=(FormHistory.formID == LaborStatusForm.laborStatusFormID))
124+
.join(FormHistory, on=(FormHistory.formID == LaborStatusForm.laborStatusFormID))
125+
.switch(LaborStatusForm)
126126
.join(Department, on=(LaborStatusForm.department == Department.departmentID))
127127
.where(
128128
(Department.ACCOUNT == departmentAcct) &
129129
(Department.ORG == departmentOrg)
130130
)
131131
)
132-
positions = set(positions)
133132
positionDict = {}
134133
for position in positions:
135-
print(position.formID.POSN_CODE, "positionsssssss")
136-
if position.formID.POSN_CODE != "S12345" or currentUser.isLaborAdmin:
137-
positionDict[position.formID.POSN_CODE] = {"position": position.formID.POSN_TITLE, "WLS":position.formID.WLS, "positionCode":position.formID.POSN_CODE}
138-
print(positionDict, "seeeeeee")
134+
if position.POSN_CODE != "S12345" or currentUser.isLaborAdmin:
135+
positionDict[position.POSN_CODE] = {"position": position.POSN_TITLE, "WLS":position.WLS, "positionCode":position.POSN_CODE}
139136
return json.dumps(positionDict)
140137

141138
@main_bp.route("/laborstatusform/getstudents/<termCode>/<student>", methods=["POST"])
@@ -170,7 +167,6 @@ def checkTotalHours(termCode, student, hours):
170167
((FormHistory.status == "Approved") | (FormHistory.status == "Pending"))
171168
)
172169
term = Term.get(Term.termCode == termCode)
173-
print("yeet", positions)
174170
totalHours = 0
175171
for item in positions:
176172
formID = item.formID
@@ -201,7 +197,6 @@ def releaseAndRehire():
201197

202198
# Create new labor status form
203199
student = Student.get(Student.ID == studentDict['stuBNumber'])
204-
print("## app/controllers/mainroutes/releaseandrehire##")
205200
supervisor = Supervisor.get(Supervisor.ID == studentDict['stuSupervisorID'])
206201
department, created = Department.get_or_create(DEPT_NAME = studentDict['stuDepartment'])
207202
term, created = Term.get_or_create(termCode = studentDict['stuTermCode'])

app/logic/adminManagement.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ def searchForAdmin(rsp):
1111
adminType = rsp[0]
1212
userList = []
1313
if adminType == "addlaborAdmin":
14-
print("starts1")
15-
print("##need to work on this there is a chance we need to strip the string app/logic/adminManagement/searchForAdmin##")
1614
databaseStudents = Student.select().where(Student.legal_name.contains(userInput) | Student.preferred_name.contains(userInput)| Student.LAST_NAME.contains(userInput))
1715
students = []
1816
for student in databaseStudents:
@@ -31,7 +29,6 @@ def searchForAdmin(rsp):
3129
'lastName': student.LAST_NAME,
3230
'type': 'Student'
3331
})
34-
print("#chapapa#need to work on this there is a chance we need to strip the string app/logic/adminManagement/searchForAdmin##")
3532
databaseSupervisors = Supervisor.select().where(Supervisor.legal_name.contains(userInput) | Supervisor.preferred_name.contains(userInput)| Supervisor.LAST_NAME.contains(userInput))
3633
supervisors = []
3734
for supervisor in databaseSupervisors:

app/logic/allPendingForms.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def overrideOriginalStatusFormOnAdjustmentFormApproval(form, LSF):
9090
9191
The only fields that will ever be changed in an adjustment form are: supervisor, department, position, and hours.
9292
"""
93-
print(form.adjustedForm.newValue, "heheee")
9493
currentUser = require_login()
9594
if not currentUser: # Not logged in
9695
return render_template('errors/403.html'), 403
@@ -107,14 +106,9 @@ def overrideOriginalStatusFormOnAdjustmentFormApproval(form, LSF):
107106

108107
if form.adjustedForm.fieldAdjusted == "position":
109108
LSF.POSN_CODE = form.adjustedForm.newValue
110-
position = (
111-
FormHistory
112-
.select(FormHistory, LaborStatusForm, Department)
113-
.join(LaborStatusForm, on=(FormHistory.formID == LaborStatusForm.laborStatusFormID))
114-
.join(Department, on=(LaborStatusForm.department == Department.departmentID))
115-
.where(LaborStatusForm.POSN_CODE == form.adjustedForm.newValue)
116-
.get_or_none()
117-
)
109+
position = LaborStatusForm.get_or_none(
110+
LaborStatusForm.POSN_CODE == fieldsChanged[fieldName]["newValue"]
111+
)
118112
LSF.POSN_TITLE = position.POSN_TITLE
119113
LSF.WLS = position.WLS
120114
LSF.save()
@@ -292,10 +286,10 @@ def checkAdjustment(allForms):
292286
newPositionCode = allForms.adjustedForm.newValue
293287
newPosition = (
294288
LaborStatusForm
295-
.select(LaborStatusForm.POSN_CODE, LaborStatusForm.WLS, LaborStatusForm.POSN_TITLE)
289+
.select()
296290
.where(LaborStatusForm.POSN_CODE == newPositionCode)
297291
.first()
298-
)
292+
)
299293
# temporarily storing the position code and wls in new value, and position name in old value
300294
# because we want to show these information in the hmtl template.
301295
allForms.adjustedForm.newValue = newPosition.POSN_CODE +" (" + newPosition.WLS+")"

app/logic/emailHandler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ def __init__(self, formHistoryKey):
7474
elif self.formHistory.adjustedForm.fieldAdjusted == "position":
7575
currentPosition = (
7676
LaborStatusForm
77-
.select(LaborStatusForm.POSN_CODE, LaborStatusForm.POSN_TITLE, LaborStatusForm.WLS)
77+
.select()
7878
.where(LaborStatusForm.POSN_CODE == self.formHistory.adjustedForm.oldValue)
7979
.first()
8080
)
8181
newPosition = (
8282
LaborStatusForm
83-
.select(LaborStatusForm.POSN_CODE, LaborStatusForm.POSN_TITLE, LaborStatusForm.WLS)
83+
.select()
8484
.where(LaborStatusForm.POSN_CODE == self.formHistory.adjustedForm.newValue)
8585
.first()
8686
)

db_test.py

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)