Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
0b6e0bc
changed accordions
jjijon7000 Jun 10, 2025
038c1cd
changed design
jjijon7000 Jun 11, 2025
b45cdec
added user information accordion and changed the design
jjijon7000 Jun 11, 2025
832596f
changed where print travel form manage cce minor links are at
jjijon7000 Jun 11, 2025
8975b7a
changed p tags to buttons and put them into columns
jjijon7000 Jun 12, 2025
1c59444
changed button sizing
jjijon7000 Jun 12, 2025
40b5049
changed edit phone number element to icon and save phone number to icon
jjijon7000 Jun 12, 2025
8bfec02
more changes to html icons
jjijon7000 Jun 12, 2025
4ee7633
changed tag from volunteer information to edit volunteer information
jjijon7000 Jun 12, 2025
d5f767d
added accessibility to icons
jjijon7000 Jun 12, 2025
b0e314a
removed some whitespace
jjijon7000 Jun 12, 2025
70f6e86
cleaned up code
jjijon7000 Jun 12, 2025
8b56d48
coverted edit volunteer into modal. modal is working, however some fu…
jjijon7000 Jun 13, 2025
8870acd
modal is working correctly and all functionalities are running correctly
jjijon7000 Jun 13, 2025
28079d3
changed the positioning of the edit volunteer button
jjijon7000 Jun 13, 2025
3bd31b2
Change some HTML and JS
Shenderaz Jun 13, 2025
59b86fc
removed save dietary information button and set autosave instead
jjijon7000 Jun 13, 2025
ccbf755
merged with minoraccordion and placed manage cce button inside the ac…
Shenderaz Jun 13, 2025
2890364
fixed cce minor accordion design
Shenderaz Jun 13, 2025
dd655ac
fixed focus on the accordions
Shenderaz Jun 13, 2025
4e741ab
Fixed the hr tag in the cce accordion.
Shenderaz Jun 13, 2025
953f97f
Merge branch 'development' into accordion-design-1453
Karina-Agliullova Jun 16, 2025
f156353
changed code based on the pr messages
jjijon7000 Jun 18, 2025
2874c2b
fixed the saved! text in the js file
jjijon7000 Jun 18, 2025
be3ee5b
Merge branch 'development' into accordion-design-1453
jjijon7000 Jun 24, 2025
0797d48
Merge branch 'development' into accordion-design-1453
jjijon7000 Jun 25, 2025
71d3c64
Added the danger message to the event template for students staff who…
mathew2005 Jul 3, 2025
4309887
Merge branch 'development' into accordion-design-1453
jjijon7000 Jul 7, 2025
ce82cb4
Merge branch 'development' into accordion-design-1453
BrianRamsay Jul 8, 2025
ec9e811
fixed some issues
jjijon7000 Jul 8, 2025
09d69bb
fixed everything
jjijon7000 Jul 8, 2025
b60e2cc
Merge branch 'development' into accordion-design-1453
jjijon7000 Jul 11, 2025
ed1a932
Merge branch 'development' into accordion-design-1453
jjijon7000 Jul 11, 2025
8efb323
Added global data so sidebar can acess Program Manager data. Still ne…
mathew2005 Jul 11, 2025
ed99c4f
Create Event link in the navbar no longer appears when you are not a …
mathew2005 Jul 14, 2025
d842c2e
Cleaned up commented out and unnecessary code written from earlier co…
mathew2005 Jul 15, 2025
5c16917
changed isprogramManager to isProgramManager
mathew2005 Jul 15, 2025
077bd1c
Merge branch 'development' into 1558_event_blank
BrianRamsay Jul 15, 2025
b218067
Used another method of checking if a student staff is program manager…
mathew2005 Jul 15, 2025
18c1967
removed no longer used code to inject global data
mathew2005 Jul 15, 2025
f92fa99
Merge branch 'development' into accordion-design-1453
Karina-Agliullova Jul 15, 2025
5327e3d
Merge branch 'development' into 1558_event_blank
Karina-Agliullova Jul 16, 2025
d2c9860
Merge branch 'development' into accordion-design-1453
jjijon7000 Jul 16, 2025
b34ffd9
Changes other Events to Celts Labor with the events that are marked L…
PuskarC Jul 18, 2025
155d374
'Student-Led Services' renamed to 'Volunteer Opportunities'
PuskarC Jul 18, 2025
2c8b9e0
Changed Student led service and its all occurence to Volunteer Opport…
PuskarC Jul 18, 2025
e7b03bb
Fixed the Training and Education and Engagement tabs so that it exclu…
PuskarC Jul 18, 2025
4137e76
'Volunteer Opportunities" now only show events with the isService fl…
bakobagassas Jul 21, 2025
202c81f
solved the testing issue
bakobagassas Jul 21, 2025
ef90ec2
solved second testing issue
bakobagassas Jul 21, 2025
ee29e09
implemeted all requested changes from PR comments
bakobagassas Jul 29, 2025
d9bafe6
Merge branch 'development' into Celts-Labor
bakobagassas Jul 29, 2025
bd60f5f
Fix errors in import_users script
BrianRamsay Jul 29, 2025
8d1b336
Merge branch 'development' of github.com:BCStudentSoftwareDevTeam/cel…
BrianRamsay Jul 29, 2025
4f03722
Merge branch 'development' into Celts-Labor
bakobagassas Jul 29, 2025
09809a9
Update python packages to newest version
BrianRamsay Aug 6, 2025
4e0c6fc
Merge profile changes from development
BrianRamsay Aug 8, 2025
1158585
Dietary Restriction changes work, adjusted link display, removed old …
BrianRamsay Aug 8, 2025
3cfa2b7
Open travel form in new window for printing
BrianRamsay Aug 8, 2025
1a5a130
Fix python version error
BrianRamsay Aug 8, 2025
90d8e08
Merge pull request #1507 from BCStudentSoftwareDevTeam/accordion-desi…
BrianRamsay Aug 8, 2025
df8237e
Resolves #1559
BrianRamsay Aug 8, 2025
5c9f0f6
Save button now will always be visible on the create event page. Star…
BrianRamsay Aug 8, 2025
4634660
Merge pull request #1605 from BCStudentSoftwareDevTeam/fixed-save-btn…
BrianRamsay Aug 8, 2025
14a169b
Fix logout url
BrianRamsay Aug 18, 2025
eef03e2
Merge branch 'development' into Celts-Labor
bakobagassas Sep 2, 2025
0761cae
Fixed issue with editing event term
BrianRamsay Sep 10, 2025
38d7889
Remove unneeded line
BrianRamsay Sep 10, 2025
353ca44
Merge pull request #1625 from BCStudentSoftwareDevTeam/production-ter…
BrianRamsay Sep 10, 2025
d73a0b7
Removed the Oops
ojmakinde Sep 11, 2025
10d1644
Added an extra variable for clarity
ojmakinde Sep 11, 2025
6feb62d
Program Managers can now create events in their programs
ojmakinde Sep 11, 2025
dbac8f5
Merge remote-tracking branch 'origin' into 1558_event_blank
ojmakinde Sep 11, 2025
5f49372
Removed the ability for student staff to create events in all programs
ojmakinde Sep 11, 2025
1666bf2
Merge branch 'development' of https://github.com/BCStudentSoftwareDev…
ojmakinde Sep 11, 2025
8f8066d
Merge pull request #1581 from BCStudentSoftwareDevTeam/1558_event_blank
BrianRamsay Sep 12, 2025
b6fa570
added validity tag requirement for name field
bakobagassas Sep 12, 2025
a78fce1
Merge branch 'development' into Celts-Labor
Karina-Agliullova Sep 15, 2025
7793a81
Done
bakobagassas Sep 16, 2025
62c2691
solved bug
bakobagassas Oct 10, 2025
3de9f5b
done with flash message
bakobagassas Oct 11, 2025
6b1191f
cleaned up
bakobagassas Oct 16, 2025
679026e
Merge pull request #1633 from BCStudentSoftwareDevTeam/flash_message
BrianRamsay Oct 16, 2025
85a284b
Merge branch 'development' into frequency
BrianRamsay Oct 16, 2025
4a7b854
Merge pull request #1628 from BCStudentSoftwareDevTeam/frequency
BrianRamsay Oct 16, 2025
751af30
Merge branch 'development' into Celts-Labor
esw0624 Oct 29, 2025
ff79b8d
Temporarily remove broken spreadsheet tests
BrianRamsay Nov 4, 2025
b622f9b
Merge branch 'development' into Celts-Labor
bakobagassas Nov 5, 2025
082024b
started implementing requested changes for celts labor tab
bakobagassas Nov 6, 2025
946c6ed
Merge branch 'Celts-Labor' of https://github.com/BCStudentSoftwareDev…
bakobagassas Nov 6, 2025
d585ac9
Fixed the error on getting into the Event List
esw0624 Nov 10, 2025
e86719f
rewinded, fixed broken page and some logic issues. Still need to chec…
bakobagassas Nov 11, 2025
262dcd4
Labor events are not showing up in engagement and training
bakobagassas Nov 11, 2025
158ca14
Program managers can now see background check
bakobagassas Nov 13, 2025
fc8e9f7
Merge branch 'development' into backgroundCheck
bakobagassas Nov 13, 2025
ee572ce
Merge branch 'development' of https://github.com/BCStudentSoftwareDev…
JohnCox2211 Nov 13, 2025
98a9591
Merge branch 'backgroundCheck' of https://github.com/BCStudentSoftwar…
JohnCox2211 Nov 13, 2025
1f7ab42
now they connot modify, only view
bakobagassas Nov 13, 2025
0f552df
removed "remove button" for student staff
bakobagassas Nov 13, 2025
6feb65e
Student Staff can view only the backgroundCheckType that has submitte…
esw0624 Nov 14, 2025
62e552e
Merge branch 'backgroundCheck' of https://github.com/BCStudentSoftwar…
bakobagassas Nov 14, 2025
dfddb03
removed re-annotation
bakobagassas Nov 18, 2025
9b49f21
Added No Background Check Description
esw0624 Nov 18, 2025
1cfc46b
Pushing Test Code
esw0624 Nov 18, 2025
15282d1
Removing repetitive code logic based on John's comment
esw0624 Nov 18, 2025
0e1cb1c
Volunteer opp. in programs
bakobagassas Nov 18, 2025
86c7fda
landing page
bakobagassas Nov 18, 2025
2a9cb59
Resolving John's comment
esw0624 Nov 19, 2025
f22fa65
Vol. Opp. and landing page thing
bakobagassas Nov 20, 2025
77db936
Fixed the issue with the engagement tab
bakobagassas Nov 20, 2025
e7b915f
variable names
bakobagassas Nov 20, 2025
4f5de80
Implemented logic for when a student has a labor position with celts.
bakobagassas Nov 21, 2025
ff3fc96
Simplify background check display logic
BrianRamsay Nov 21, 2025
fc86acd
Merge pull request #1638 from BCStudentSoftwareDevTeam/backgroundCheck
BrianRamsay Nov 24, 2025
340c523
Merge branch 'development' into Celts-Labor
BrianRamsay Nov 24, 2025
3413679
Allow Bonner Scholars events in the transcript
BrianRamsay Nov 24, 2025
26cbe75
Merge branch 'development' of github.com:BCStudentSoftwareDevTeam/cel…
BrianRamsay Nov 24, 2025
9275d4b
Merge pull request #1639 from BCStudentSoftwareDevTeam/fix-branch
BrianRamsay Nov 24, 2025
349bd0c
Merge branch 'development' into Celts-Labor
BrianRamsay Nov 24, 2025
17bea25
fixed syntax errors
bakobagassas Nov 24, 2025
50286e7
Merge branch 'Celts-Labor' of https://github.com/BCStudentSoftwareDev…
bakobagassas Nov 24, 2025
b2ff1f7
fixed landing page failing test
bakobagassas Nov 24, 2025
1ede70c
Fixed error with hasCurrentCeltsLabor
bakobagassas Nov 24, 2025
b819c24
Fixed event test failure!! no more tests failing (hopefully)
bakobagassas Nov 24, 2025
14e77c0
importing term
bakobagassas Nov 25, 2025
32563e2
Pulling
esw0624 Nov 25, 2025
67e1ab7
Merging remote branch
esw0624 Nov 25, 2025
e5de7b3
commiting changes
esw0624 Nov 25, 2025
9d7cc81
term import
bakobagassas Nov 25, 2025
3188bb2
corrected syntax that had been mysteriously changed
bakobagassas Nov 25, 2025
a912c38
backup alter the table
bakobagassas Nov 25, 2025
f29576b
Fixing Event List Crashing when invalid term ID is selected
esw0624 Nov 25, 2025
b9cbb16
Fixed mismatching and misssing events from backup (tested in developm…
bakobagassas Nov 26, 2025
05d6ec8
Fix Program table column ordering
BrianRamsay Dec 4, 2025
52a55df
fix hasCurrentCeltsLabor
BrianRamsay Dec 4, 2025
2c9cae7
New test for hasCurrentCeltsLabor, the test is passing
bakobagassas Dec 4, 2025
508b125
New test for hasCurrentCeltsLabor, the test is passing
bakobagassas Dec 4, 2025
79d6377
Standardize messages for each tab when there are no events
BrianRamsay Dec 17, 2025
a736e7c
Only show 'There are no upcoming events' message when past events are…
BrianRamsay Dec 17, 2025
44030d9
Clarify term handling
BrianRamsay Dec 17, 2025
8b432f0
Remove extraneous SQL
BrianRamsay Dec 17, 2025
5af278e
Fix landing page active tab logic to match usage
BrianRamsay Dec 17, 2025
2ff26b8
Fix landing page test
BrianRamsay Dec 17, 2025
6399d69
Fix landing page test
BrianRamsay Dec 17, 2025
d44a340
Merge pull request #1584 from BCStudentSoftwareDevTeam/Celts-Labor
BrianRamsay Dec 17, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/actionTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
pull-requests: write
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12","3.13"]

# each step can define `env` vars, but it's easiest to define them on the build level
env:
Expand Down
1 change: 1 addition & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# Initialize our application
app = Flask(__name__, template_folder="templates")
app.jinja_env.add_extension('jinja2.ext.loopcontrols')

app.env = os.environ.get('APP_ENV', 'production')
load_config_files(app)
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import os
#from app.login_manager import require_login


#@app.context_processor
#def injectGlobalData():
#currentUser = require_login()
#lastStaticUpdate = str(max(os.path.getmtime(os.path.join(root_path, f))
# for root_path, dirs, files in os.walk('app/static')
# for f in files))
#return {'currentUser': currentUser,
# 'lastStaticUpdate': lastStaticUpdate}
# 'lastStaticUpdate': lastStaticUpdate}
25 changes: 10 additions & 15 deletions app/controllers/admin/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,18 @@ def switchUser():

@admin_bp.route('/eventTemplates')
def templateSelect():
if g.current_user.isCeltsAdmin or g.current_user.isCeltsStudentStaff:
allprograms = getAllowedPrograms(g.current_user)
visibleTemplates = getAllowedTemplates(g.current_user)
return render_template("/events/templateSelector.html",
programs=allprograms,
celtsSponsoredProgram = Program.get(Program.isOtherCeltsSponsored),
templates=visibleTemplates)
else:
programs = getAllowedPrograms(g.current_user)
if not programs:
abort(403)

visibleTemplates = getAllowedTemplates(g.current_user)
return render_template("/events/templateSelector.html",
programs=programs,
celtsSponsoredProgram = Program.get(Program.isOtherCeltsSponsored),
templates=visibleTemplates)

@admin_bp.route('/eventTemplates/<templateid>/<programid>/create', methods=['GET','POST'])
def createEvent(templateid, programid):
if not (g.current_user.isAdmin or g.current_user.isProgramManagerFor(programid)):
if not (g.current_user.isCeltsAdmin or g.current_user.isProgramManagerFor(programid)):
abort(403)

# Validate given URL
Expand Down Expand Up @@ -173,8 +171,6 @@ def createEvent(templateid, programid):
preprocessEventData(eventData)
isProgramManager = g.current_user.isProgramManagerFor(programid)

futureTerms = selectSurroundingTerms(g.current_term, prevTerms=0)

requirements, bonnerCohorts = [], []
if eventData['program'] is not None and eventData['program'].isBonnerScholars:
requirements = getCertRequirements(Certification.BONNER)
Expand All @@ -189,7 +185,7 @@ def createEvent(templateid, programid):
return render_template(f"/events/{template.templateFile}",
template = template,
eventData = eventData,
futureTerms = futureTerms,
termList = selectSurroundingTerms(g.current_term, prevTerms=0),
requirements = requirements,
bonnerCohorts = bonnerCohorts,
isProgramManager = isProgramManager)
Expand Down Expand Up @@ -314,7 +310,6 @@ def eventDisplay(eventId):
# make sure our data is the same regardless of GET and POST
preprocessEventData(eventData)
eventData['program'] = event.program
futureTerms = selectSurroundingTerms(g.current_term)
userHasRSVPed = checkUserRsvp(g.current_user, event)
filepaths = FileHandler(eventId=event.id).retrievePath(associatedAttachments)
isProgramManager = g.current_user.isProgramManagerFor(eventData['program'])
Expand Down Expand Up @@ -342,7 +337,7 @@ def eventDisplay(eventId):
if 'edit' in rule.rule:
return render_template("events/createEvent.html",
eventData = eventData,
futureTerms = futureTerms,
termList = Term.select().order_by(Term.termOrder),
event = event,
requirements = requirements,
bonnerCohorts = bonnerCohorts,
Expand Down
1 change: 1 addition & 0 deletions app/controllers/admin/userManagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,5 @@ def changeTerm():
@admin_bp.route('/admin/addNewTerm', methods = ['POST'])
def addNewTerm():
addNextTerm()
flash("New term added", "success")
return ""
56 changes: 28 additions & 28 deletions app/controllers/main/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from app.models.courseInstructor import CourseInstructor
from app.models.backgroundCheckType import BackgroundCheckType

from app.logic.events import getUpcomingEventsForUser, getParticipatedEventsForUser, getTrainingEvents, getEventRsvpCountsForTerm, getUpcomingStudentLedCount, getStudentLedEvents, getBonnerEvents, getOtherEvents, getEngagementEvents
from app.logic.events import getUpcomingEventsForUser, getParticipatedEventsForUser, getTrainingEvents, getEventRsvpCountsForTerm, getUpcomingVolunteerOpportunitiesCount, getVolunteerOpportunities, getBonnerEvents, getCeltsLabor, getEngagementEvents
from app.logic.transcript import *
from app.logic.loginManager import logout
from app.logic.searchUsers import searchUsers
Expand Down Expand Up @@ -69,49 +69,53 @@ def landingPage():
def goToEventsList(programID):
return {"activeTab": getActiveEventTab(programID)}

@main_bp.route('/eventsList/<selectedTerm>', methods=['GET'], defaults={'activeTab': "studentLedEvents", 'programID': 0})
@main_bp.route('/eventsList/<selectedTerm>', methods=['GET'], defaults={'activeTab': "volunteerOpportunities", 'programID': 0})
@main_bp.route('/eventsList/<selectedTerm>/', methods=['GET'], defaults={'activeTab': "volunteerOpportunities", 'programID': 0})
@main_bp.route('/eventsList/<selectedTerm>/<activeTab>', methods=['GET'], defaults={'programID': 0})
@main_bp.route('/eventsList/<selectedTerm>/<activeTab>/<programID>', methods=['GET'])
def events(selectedTerm, activeTab, programID):
currentTerm = g.current_term
if selectedTerm:
currentTerm = selectedTerm


currentTime = datetime.datetime.now()
listOfTerms = Term.select().order_by(Term.termOrder)
participantRSVP = EventRsvp.select(EventRsvp, Event).join(Event).where(EventRsvp.user == g.current_user)
rsvpedEventsID = [event.event.id for event in participantRSVP]

term: Term = Term.get_by_id(currentTerm)
term = g.current_term
if selectedTerm:
term = selectedTerm

# Make sure we have a Term object
term = Term.get_or_none(Term.id == term)
if term is None:
term = Term.get(Term.isCurrentTerm == True)

currentEventRsvpAmount = getEventRsvpCountsForTerm(term)
studentLedEvents = getStudentLedEvents(term)
countUpcomingStudentLedEvents = getUpcomingStudentLedCount(term, currentTime)
volunteerOpportunities = getVolunteerOpportunities(term)
countUpcomingVolunteerOpportunities = getUpcomingVolunteerOpportunitiesCount(term, currentTime)
trainingEvents = getTrainingEvents(term, g.current_user)
engagementEvents = getEngagementEvents(term)
bonnerEvents = getBonnerEvents(term)
otherEvents = getOtherEvents(term)
celtsLabor = getCeltsLabor(term)

managersProgramDict = getManagerProgramDict(g.current_user)

# Fetch toggle state from session
toggleState = request.args.get('toggleState', 'unchecked')

# compile all student led events into one list
# compile all volunteer opportunitiesevents into one list
studentEvents = []
for studentEvent in studentLedEvents.values():
for studentEvent in volunteerOpportunities.values():
studentEvents += studentEvent # add all contents of studentEvent to the studentEvents list

# Get the count of all term events for each category to display in the event list page.
studentLedEventsCount: int = len(studentEvents)
volunteerOpportunitiesCount: int = len(studentEvents)
trainingEventsCount: int = len(trainingEvents)
engagementEventsCount: int = len(engagementEvents)
bonnerEventsCount: int = len(bonnerEvents)
otherEventsCount: int = len(otherEvents)
celtsLaborCount: int = len(celtsLabor)

# gets only upcoming events to display in indicators
if (toggleState == 'unchecked'):
studentLedEventsCount: int = sum(list(countUpcomingStudentLedEvents.values()))
for event in trainingEvents:
if event.isPastEnd:
trainingEventsCount -= 1
Expand All @@ -121,28 +125,27 @@ def events(selectedTerm, activeTab, programID):
for event in bonnerEvents:
if event.isPastEnd:
bonnerEventsCount -= 1
for event in otherEvents:
for event in celtsLabor:
if event.isPastEnd:
otherEventsCount -= 1

celtsLaborCount -= 1
# Handle ajax request for Event category header number notifiers and toggle
if request.headers.get('X-Requested-With') == 'XMLHttpRequest':
return jsonify({
"studentLedEventsCount": studentLedEventsCount,
"volunteerOpportunitiesCount": volunteerOpportunitiesCount,
"trainingEventsCount": trainingEventsCount,
"engagementEventsCount": engagementEventsCount,
"bonnerEventsCount": bonnerEventsCount,
"otherEventsCount": otherEventsCount,
"celtsLaborCount": celtsLaborCount,
"toggleStatus": toggleState
})

return render_template("/events/eventList.html",
selectedTerm = term,
studentLedEvents = studentLedEvents,
volunteerOpportunities = volunteerOpportunities,
trainingEvents = trainingEvents,
engagementEvents = engagementEvents,
bonnerEvents = bonnerEvents,
otherEvents = otherEvents,
celtsLabor = celtsLabor,
listOfTerms = listOfTerms,
rsvpedEventsID = rsvpedEventsID,
currentEventRsvpAmount = currentEventRsvpAmount,
Expand All @@ -151,7 +154,7 @@ def events(selectedTerm, activeTab, programID):
activeTab = activeTab,
programID = int(programID),
managersProgramDict = managersProgramDict,
countUpcomingStudentLedEvents = countUpcomingStudentLedEvents,
countUpcomingVolunteerOpportunities = countUpcomingVolunteerOpportunities,
toggleState = toggleState,
)

Expand Down Expand Up @@ -243,7 +246,6 @@ def viewUsersProfile(username):
managersList = managersList,
participatedInLabor = getCeltsLaborHistory(volunteer),
totalSustainedEngagements = totalSustainedEngagements,
expressInterest = volunteer.minorInterest
)
abort(403)

Expand Down Expand Up @@ -306,9 +308,7 @@ def insuranceInfo(username):
if g.current_user.username != username:
abort(403)

rowsUpdated = InsuranceInfo.update(**request.form).where(InsuranceInfo.user == username).execute()
if not rowsUpdated:
InsuranceInfo.create(user = username, **request.form)
InsuranceInfo.replace({**request.form, "user": username}).execute()

createActivityLog(f"{g.current_user.fullName} updated {user.fullName}'s insurance information.")
flash('Insurance information saved successfully!', 'success')
Expand Down
86 changes: 44 additions & 42 deletions app/logic/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,45 +224,55 @@ def saveEventToDb(newEventData, renewedEvent = False):
eventRecords.append(eventRecord)
return eventRecords

def getStudentLedEvents(term):
studentLedEvents = list(Event.select(Event, Program)
def getVolunteerOpportunities(term):
volunteerOpportunities = list(Event.select(Event, Program)
.join(Program)
.where(Program.isStudentLed,
Event.term == term, Event.deletionDate == None)
.where((Event.term == term) &
(Event.deletionDate.is_null(True)) &
(Event.isService == True) &
((Event.isLaborOnly == False) | Event.isLaborOnly.is_null(True))
)
.order_by(Event.startDate, Event.timeStart)
.execute())

programs = {}

for event in studentLedEvents:
for event in volunteerOpportunities:
programs.setdefault(event.program, []).append(event)

return programs

def getEngagementEvents(term):
engagementEvents = list(Event.select(Event, Program)
.join(Program)
.where(Event.isEngagement,
.where(Event.isEngagement, Event.isLaborOnly == False,
Event.term == term, Event.deletionDate == None)
.order_by(Event.startDate, Event.timeStart)
.execute())
return engagementEvents

def getUpcomingStudentLedCount(term, currentTime):
def getUpcomingVolunteerOpportunitiesCount(term, currentTime):
"""
Return a count of all upcoming events for each student led program.
Return a count of all upcoming events for each volunteer opportunitiesprogram.
"""

upcomingCount = (Program.select(Program.id, fn.COUNT(Event.id).alias("eventCount"))
.join(Event, on=(Program.id == Event.program_id))
.where(Program.isStudentLed,
Event.term == term, Event.deletionDate == None,
(Event.startDate > currentTime) | ((Event.startDate == currentTime) & (Event.timeEnd >= currentTime)),
Event.isCanceled == False)
.group_by(Program.id))

programCountDict = {}
upcomingCount = (
Program
.select(Program.id, fn.COUNT(Event.id).alias("eventCount"))
.join(Event, on=(Program.id == Event.program_id))
.where(
(Event.term == term) &
(Event.deletionDate.is_null(True)) &
(Event.isService == True) &
((Event.isLaborOnly == False) | Event.isLaborOnly.is_null(True)) &
((Event.startDate > currentTime) |
((Event.startDate == currentTime) & (Event.timeEnd >= currentTime))) &
(Event.isCanceled == False)
)
.group_by(Program.id)
)

programCountDict = {}
for programCount in upcomingCount:
programCountDict[programCount.id] = programCount.eventCount
return programCountDict
Expand All @@ -279,7 +289,7 @@ def getTrainingEvents(term, user):
"""
trainingQuery = (Event.select(Event).distinct()
.join(Program, JOIN.LEFT_OUTER)
.where(Event.isTraining == True,
.where(Event.isTraining == True, Event.isLaborOnly == False,
Event.term == term, Event.deletionDate == None)
.order_by(Event.isAllVolunteerTraining.desc(), Event.startDate, Event.timeStart))

Expand All @@ -290,36 +300,28 @@ def getTrainingEvents(term, user):
return list(trainingQuery.execute())

def getBonnerEvents(term):
bonnerScholarsEvents = list(Event.select(Event, Program.id.alias("program_id"))
.join(Program)
.where(Program.isBonnerScholars,
Event.term == term, Event.deletionDate == None)
.order_by(Event.startDate, Event.timeStart)
.execute())
bonnerScholarsEvents = list(
Event.select(Event, Program.id.alias("program_id"))
.join(Program)
.where(
Program.isBonnerScholars,
Event.term == term,
Event.deletionDate == None
)
.order_by(Event.startDate, Event.timeStart)
.execute()
)
return bonnerScholarsEvents

def getOtherEvents(term):
def getCeltsLabor(term):
"""

Get the list of the events not caught by other functions to be displayed in
the Other Events section of the Events List page.
:return: A list of Other Event objects
Labor tab: events explicitly marked as Labor Only.
"""
# Gets all events that are not associated with a program and are not trainings
# Gets all events that have a program but don't fit anywhere

otherEvents = list(Event.select(Event, Program)
.join(Program, JOIN.LEFT_OUTER)
.where(Event.term == term, Event.deletionDate == None,
Event.isTraining == False,
Event.isAllVolunteerTraining == False,
((Program.isOtherCeltsSponsored) |
((Program.isStudentLed == False) &
(Program.isBonnerScholars == False))))
celtsLabor = list(Event.select()
.where(Event.term == term, Event.deletionDate == None, Event.isLaborOnly == True)
.order_by(Event.startDate, Event.timeStart, Event.id)
.execute())

return otherEvents
return celtsLabor

def getUpcomingEventsForUser(user, asOf=datetime.now(), program=None):
"""
Expand Down
12 changes: 7 additions & 5 deletions app/logic/landingPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ def getManagerProgramDict(user):
managerProgramDict[row.program]["managers"] = f'{managerProgramDict[row.program]["managers"]}, {row.user.firstName} {row.user.lastName}'
return managerProgramDict

def getActiveEventTab(programID):
program = Program.get_by_id(programID)
def getActiveEventTab(programID=None):
try:
program = Program.get_by_id(programID)
except Program.DoesNotExist:
return "celtsLabor"

if program.isBonnerScholars:
return "bonnerScholarsEvents"
elif program.isStudentLed:
return "studentLedEvents"
else:
return "otherEvents"
return "volunteerOpportunities"
Loading