Skip to content

Celts labor api - #1771

Open
MImran2002 wants to merge 7 commits into
developmentfrom
CELTSLaborAPI
Open

Celts labor api#1771
MImran2002 wants to merge 7 commits into
developmentfrom
CELTSLaborAPI

Conversation

@MImran2002

@MImran2002 MImran2002 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Issue Description

Fixes issue #BCStudentSoftwareDevTeam/lsf#553

  • It appears that the feature that imports CELTS labor positions from LSF is not working. For example, user ramireza2 had a 2024-2025 position with CELTS.
  • Normal students can access CCE Minor proposal page
  • Student search not searching prefix and suffix searches like "Nyan Lin Zaw" or "Emma Mae Grooms" or "Nyan Lin" or "Lin Zaw" works
  • The Annual report download is fixed
  • default.yaml is update to also have lsf_url

Changes

  • The API from LSF works it is sending correctly what happened is within getCeltsLaborHistory if the student is working the same position title when the for loops run through the query it keeps replacing the same key within the dictionary with the same position even though the term changes.
  • This is fixed by first sorting through the terms as we want to catch the edge case of the student having a different position in spring we can now show a separate fall and spring labor position and if they only have fall labor it is assumed as AY 2025-2026.
  • Then the second loop is we use the id as a key and a tuple of term description and position to make sure it doesn't have the same error as before.
  • The terms are also in ascending order by termorder.
  • For the search there is an ambiguity problem of what could be counted as first name and last name it can be "Emma Mae" and "Grooms" or the name can also be "Emma" and "Mae Grooms" so we fixed that ambiguity problem along with prefix problem in case we type "Emma M" it will still show as "Emma Mae Grooms" as an option. Moreover, cases where if the search is "Lin Zaw" or "Mae Grooms" it will work too.
  • The search bar nows allow user to click the name instead of doing an additional enter to go to the user profile.
  • For the access problem every student can access it before now only the User themselves, User.isAdmin and User.isStudentStaff can do so.
  • Operations Team is added in the sidebar but has added Scott Heggen as we want to still wait for consent from a student to use them as part of the demo.
  • Fixed the test case for the getCeltsLaborHistory function with an added test case for a labor change in spring and its expected outcome.
  • Annual Report download button in Admin>Reports is fixed.

Images:
Before:

image

After:

image

Search Bar:

image

Testing

  • Check out the branch git checkout CELTSLaborInput and git pull
  • Reset the Database to database/reset_database.sh test and run the test tests/run_tests.sh
  • Then switch back to database/reset_database.sh from-backup

Connecting LSF and CELTS

  • Go to LSF and run the program make sure to flask run it and get the ip address of it for example : http://127.0.0.1:8989 paste that address into lsfURL in getCeltsLaborFromLsf. For me I commented out LsfUrl in the code and use this: lsfUrl = "http://127.0.0.1:8989/api/org/2084"

Code example:

# lsfUrl = f"{app.config['lsf_url'].strip('/')}/api/org/2084"
lsfUrl = "http://127.0.0.1:8989/api/org/2084"

  • Then I go to LSF and in the lsf > app > config > secret_config.yaml I pasted the valid request ip as '127.0.0.1'.

Testing the connection:

-From your CELTS run python3 app/scripts/import_labor_from_lsf.py this will pull the labor data from LSF. Now any approved form in LSF of the student will be pulled and it should display on CELTS. For the edge case like having new spring labor go ahead and create and approve the labor status form. Then run the import_labor_from_lsf.py script. It will pull the updated one and you will see the changes.

Testing the search bar

-Navigate to sidebar > student search and search either of these names "Emma M" or " Nyan Li" it will show those names.

Testing CCEMinor portal

-Navigate to sidebar > student search and search Cole Collins and go to his CCE Minor page. Copy the URL : http://127.0.0.1:8080/profile/collinsc2/cceMinor then switch to student ayisie and paste it.

  • It should deny for ayisie while display for celtsadmin and studentstaff.

…e of the same key, considered edge cases if there are multiple position hold by a person and if the switch to a different position during spring which means we cannot display it as AY but as seperate spring and fall.
…studentstaff I have editted the side bar to allow someone who is studentstaff
@github-actions

Copy link
Copy Markdown

View Code Coverage

Comment thread app/templates/sidebar.html Outdated
<option {{"selected" if g.current_user.username == config.default_user }} value="{{config.default_user}}">Default User: {{config.default_user}}</option>
<option {{"selected" if g.current_user.username == "ramsayb2"}} value="ramsayb2">Admin: ramsayb2</option>
<option {{"selected" if g.current_user.username == "neillz"}} value="neillz">Student Staff: neillz</option>
<option {{"selected" if g.current_user.username == "velazquezdiaza"}} value="velazquezdiaza">Student Staff: velazquezdiaza</option>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does this work with our test data?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Pick a different user, as this is exposing this user's labor and service records to our team.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will definitely work on it and the config for api as well.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

While we are here, we will be changing the language from "Student Staff" to "Program Manager" for this role. Later, we will add another role of "Operations Team" which has slightly elevated privileges from a PM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants