Uh oh!
There was an error while loading. Please reload this page.
Adding an Allocation Review & an Allocation Request Pages - #668
Conversation
… allocation review + admins can no longer review allocations that has not been requested
| # checking if the allocation has already been approved (in other words, if an approved allocation exists) | ||
| if allocationExists(nextAY.termCode, dept, isFinal=True): | ||
| flash(f"The allocation for the {nextAY.termName.split(" ")[1]} academic year has already been approved; therefore, you can no longer resubmit it.", "danger") |
Uh oh!
There was an error while loading. Please reload this page.
| if not currentUser: # If the current user is not logged in | ||
| return render_template('errors/403.html') | ||
| if not currentUser.isLaborAdmin: | ||
| if not (currentUser.isLaborAdmin or currentUser.isLaborDepartmentStudent): |
There was a problem hiding this comment.
we can remove currentuser.islabordepartmentstudent as they re only given to pendingforms and we figured out yesterday that islaboradmin can be given to student workers
| # checking if the department has requested any allocation review | ||
| if not allocationExists(nextAY.termCode, dept, isFinal=False): | ||
| flash(f"The {dept.DEPT_NAME} department has not requested an allocation review yet.", "danger") |
There was a problem hiding this comment.
a warning or an info as this is nothing related to error it cannot be danger but this is about informing so this is likely a warning or info
| session['openTerm'] = model_to_dict(term) | ||
| g.openTerm = term | ||
| def getCurrentYear(): |
There was a problem hiding this comment.
getCurrentAY as this is grabbing academic year not just current year
| return year, year + 1 | ||
| @app.before_request | ||
| def load_currentYear(): |
| begins from the start of July). | ||
| """ | ||
| currentYear = g.currentYear[0] |
There was a problem hiding this comment.
currentYear, nextYear = g.currentYear | currentAY, nextAY = getCurrentAndNextAY() | ||
| # getting the ID of the user who approves the request | ||
| approverID = require_login().userID |
There was a problem hiding this comment.
g.currentUser.userID as currentUser is expose globally and we don't want to authenticate whenever the labor approve a allocation.
| return render_template('errors/404.html'), 404 | ||
| # cheching if the user can visit this page |
| <p align="center" id="allocationRequestSubtitle"> | ||
| <strong> | ||
| Submit an allocation request to the Labor Department |
| def load_user(): | ||
| try: | ||
| g.currentUser = dict_to_model(User, session['currentUser']) | ||
| requestUsername = getUsernameFromEnv(request.environ) |
There was a problem hiding this comment.
remove these as this would not be relevant for the issue at this point
Uh oh!
There was an error while loading. Please reload this page.
Issue
Fixes issues #613 and #614
Changes
getCurrentAndNextYear()andallocationExists()Automatic Testing
pytest tests/code/test_academicYearManager.pyandpytest tests/code/test_allocationManger.pyto make sure the newly created allocation functions work.Manual Testing
/allocations/requestto the end of the URL. You should appear on the Allocation Request page./allocations/requestto the end of the URL.