|
2 | 2 |
|
3 | 3 | from flask import abort, request |
4 | 4 | from flask_jwt_extended import get_jwt_identity, jwt_required |
5 | | -from sqlalchemy import func, case |
| 5 | +from sqlalchemy import case, func |
6 | 6 |
|
7 | 7 | from labconnect import db |
8 | 8 | from labconnect.helpers import ( |
9 | 9 | LocationEnum, |
10 | 10 | SemesterEnum, |
11 | | - format_credits, |
12 | 11 | convert_to_enum, |
| 12 | + format_credits, |
13 | 13 | ) |
14 | 14 | from labconnect.models import ( |
| 15 | + Courses, |
15 | 16 | LabManager, |
16 | 17 | Leads, |
17 | 18 | Opportunities, |
18 | | - RecommendsClassYears, |
19 | | - User, |
20 | | - Courses, |
21 | 19 | Participates, |
| 20 | + RecommendsClassYears, |
22 | 21 | RecommendsMajors, |
| 22 | + User, |
23 | 23 | UserSavedOpportunities, |
24 | 24 | ) |
25 | 25 | from labconnect.serializers import serialize_opportunity |
@@ -149,7 +149,8 @@ def getOpportunity(opp_id: int): |
149 | 149 | query = db.session.execute( |
150 | 150 | db.select( |
151 | 151 | Opportunities, |
152 | | - # Creates an array for all of the recommended class years for the opportunity labeled recommended_years |
| 152 | + # Creates an array for all of the recommended class years for the |
| 153 | + # opportunity labeled recommended_years |
153 | 154 | func.array_agg(RecommendsClassYears.class_year).label("recommended_years"), |
154 | 155 | ) |
155 | 156 | .join( |
@@ -317,7 +318,8 @@ def filterOpportunities(): |
317 | 318 | opportunity[0], |
318 | 319 | lab_managers=", ".join( |
319 | 320 | [ |
320 | | - f"{name.get('preferred_name', None) or name.get('first_name')} {name.get('last_name')}" |
| 321 | + f"{name.get('preferred_name', None) or name.get('first_name')} " |
| 322 | + f"{name.get('last_name')}" |
321 | 323 | for name in opportunity[1] |
322 | 324 | ] |
323 | 325 | ), |
@@ -404,7 +406,8 @@ def getProfileOpportunities(rcs_id: str) -> list[dict[str, str]]: |
404 | 406 | # function to search for lab managers |
405 | 407 | @main_blueprint.get("/searchLabManagers/<string:query>") |
406 | 408 | def searchLabManagers(query: str): |
407 | | - # Perform a search on User table by first name, last name, or email using ILIKE for exact partial matches |
| 409 | + # Perform a search on User table by first name, last name, or email using ILIKE |
| 410 | + # for exact partial matches |
408 | 411 | stmt = ( |
409 | 412 | db.select(User) |
410 | 413 | .join(LabManager, User.lab_manager_id == LabManager.id) |
@@ -444,7 +447,9 @@ def searchLabManagers(query: str): |
444 | 447 |
|
445 | 448 | @main_blueprint.get("/searchCourses/<string:query>") |
446 | 449 | def searchCourses(query: str): |
447 | | - # Perform a search on Courses table by code and name using ILIKE for exact partial matches |
| 450 | + # Perform a search on Courses table by code and |
| 451 | + # name using ILIKE for exact partial matches |
| 452 | + # TODO: merge into filtering |
448 | 453 | stmt = ( |
449 | 454 | db.select(Courses) |
450 | 455 | .distinct() |
@@ -880,7 +885,7 @@ def allSavedUserOportunities(): |
880 | 885 | return saved_opportunities_list, 200 |
881 | 886 |
|
882 | 887 |
|
883 | | -# Create route to allow for multiple pages to be unsaved given a list of opp_ids delete them |
| 888 | +# Create route to allow for multiple pages to be unsaved given a list of opp_ids |
884 | 889 | @main_blueprint.delete("/UnsaveMultiplePages/") |
885 | 890 | @jwt_required() |
886 | 891 | # Delete id that appear on delete_ids list |
|
0 commit comments