Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 app/controllers/main/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def viewUsersProfile(username):
totalSustainedEngagements = getEngagementTotal(getCommunityEngagementByTerm(volunteer))

handbookOverdue = getHandbookStatus(volunteer)
training = hasGoneToTraining(g.current_user, g.current_term)
training = hasGoneToTraining(volunteer, g.current_term)

return render_template ("/main/userProfile.html",
username=username,
Expand Down
2 changes: 1 addition & 1 deletion app/logic/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def getParticipatedEventsForUser(user):
.join(Program, JOIN.LEFT_OUTER).switch()
.join(EventParticipant)
.where(EventParticipant.user == user,
Event.isAllVolunteerTraining == False, Event.deletionDate == None, Event.isCeltsTraining == False)
Event.isAllVolunteerTraining == False, Event.deletionDate == None)
Comment thread
MImran2002 marked this conversation as resolved.
.order_by(Event.startDate, Event.name))

allVolunteer = (Event.select(Event, "", Value("Volunteer").alias("participatedType"), Value(0).alias("hoursEarned"))
Expand Down
2 changes: 1 addition & 1 deletion app/static/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ select.empty {
}

.scroll-container {
min-height: 100vh;
max-height: 100vh;
}

.bi-list {
Expand Down
59 changes: 32 additions & 27 deletions app/templates/main/userProfile.html
Original file line number Diff line number Diff line change
Expand Up @@ -818,38 +818,37 @@ <h5>Dietary Restrictions</h5>
</div>

<br>


{% set isOwnProfile = volunteer.bnumber == g.current_user.bnumber %}
{% set isLaborViewer = g.current_user.isAdmin or g.current_user.hasCurrentCeltsLabor %}
{% set isLaborHandbook = training.isCeltsTraining or volunteer.isAdmin or volunteer.hasCurrentCeltsLabor %}
{% set handbookAvailable = g.current_term.laborHandbook if isLaborHandbook else g.current_term.volunteerHandbook %}

<h5>AY {{g.current_term.academicYear}} Handbook</h5>
<div class="row mb-3">
<div class="row mb-3">
{# All CELTS Training #}
{% if training.isCeltsTraining %}
{% if not g.current_term.laborHandbook %}
<p>No CELTS Labor Handbook available for {{g.current_term.description}} yet.</p>
{% else %}
<p><a href="{{ url_for('static', filename='files/laborHandbook/' + g.current_term.laborHandbook|default('', true))}}" target="_blank"/>CELTS Labor Handbook</a></p>
{% endif %}

{# All Volunteer Training #}
{% if not handbookAvailable %}
<p>No {{ "CELTS Labor" if isLaborHandbook else "Volunteer" }} Handbook available for {{ g.current_term.description }} yet.</p>
{% else %}
{% if not g.current_term.volunteerHandbook %}
<p>No Volunteer Handbook available for {{g.current_term.description}} yet.</p>
{% else %}
<p><a href="{{ url_for('static', filename='files/volunteerHandbook/' + g.current_term.volunteerHandbook|default('', true))}}" target="_blank"/>CELTS Student Handbook</a></p>
{% endif %}
{% endif %}
<p>
<a href="{{ url_for( 'static', filename=( 'files/laborHandbook/' + g.current_term.laborHandbook if isLaborHandbook else 'files/volunteerHandbook/' + g.current_term.volunteerHandbook ))}}" target="_blank">
{{ "CELTS Labor Handbook" if isLaborHandbook else "CELTS Student Handbook" }}
</a>
</p>
{% endif %}
</div>

{% if g.current_user.signatureTerm.academicYear != g.current_term.academicYear and not training %}
<p>To volunteer, you must sign the CELTS handbook for {{g.current_term.academicYear}}, and you must do this at an All Volunteers Training.</p>
{% else %}
{% if volunteer.signatureTerm.academicYear != g.current_term.academicYear %}
<h5 id="signatureHeader">Sign the handbook</h5>
{% else %}
<p> Your handbook signature is good for AY {{volunteer.signatureTerm.academicYear}}.</p>
{% if handbookOverdue and not training%}
{% if isOwnProfile %}
<p>To volunteer, you must sign the CELTS handbook for {{g.current_term.academicYear}}, and you must do this at an All Volunteers Training or All CELTS Training (Labor).</p>
{% elif isLaborViewer %}
<p>To volunteer, {{volunteer.fullName}} must sign the CELTS handbook for {{g.current_term.academicYear}}, and they must do this at an All Volunteers Training or All CELTS Training (Labor).</p>
{% endif %}

{% if g.current_term.volunteerHandbook %}
{% if handbookOverdue and g.current_user.username == volunteer.username %}

{% elif handbookOverdue %}
<h5 id="signatureHeader">Sign the handbook</h5>
{% if handbookAvailable %}
{% if isOwnProfile %}
<div class="row mb-3">
<canvas id="handbook-signature-pad" class="signature-pad" data-student = {{volunteer.username}} style="border: 1px solid #ced4da"></canvas>
</div>
Expand All @@ -867,9 +866,15 @@ <h5 id="signatureHeader">Sign the handbook</h5>
<h3>Handbook signed for AY {{g.current_term.academicYear}}!</h3>
</div>
</div>
{% else %}
<p>{{ volunteer.fullName }} has attended the training but they still need to sign the CELTS handbook for {{ g.current_term.academicYear }}. </p>
{% endif %}
{% endif %}
{% endif %}
{% else %}
<p>
{% if isOwnProfile %} Your handbook signature is good for AY {% else %} {{ volunteer.fullName }}'s handbook signature is good for AY {% endif %} {{ volunteer.signatureTerm.academicYear }}.
</p>
{% endif %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
Expand Down
21 changes: 21 additions & 0 deletions tests/code/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,12 @@ def test_volunteerHistory():
contactEmail = "test@email",
contactName = "testName",)

participatedACTProgram = Program.create(id = 14,
programName = "ACT",
isBonnerScholars = False,
contactEmail = "test@email",
contactName = "testName",)

# Create a program event in the past that the test user will have
# participated in
participatedProgramEvent = Event.create(name = "Attended program event",
Expand All @@ -960,6 +966,17 @@ def test_volunteerHistory():
isAllVolunteerTraining = False,
program = participatedProgram)

participatedProgramACTEvent = Event.create(name = "All CELTS Training (Labor)",
term = 2,
description = "Test attended ACT program event.",
timeStart = "18:00:00",
timeEnd = "21:00:00",
location = "The moon",
startDate = "2021-12-12",
isAllVolunteerTraining = False,
isCeltsTraining = True,
program = participatedACTProgram)

# Create a non-program event in the past that the test user will have
# participated in
participatedEvent = Event.create(name = "Attended event",
Expand All @@ -980,6 +997,10 @@ def test_volunteerHistory():
EventParticipant.create(user = user, event = participatedEvent.id)
assert participatedEvent in getParticipatedEventsForUser(user)

# Add the created user as a participant to the created ALL CELTS Training (Labor) program event
EventParticipant.create(user = user, event = participatedProgramACTEvent.id)
assert participatedProgramACTEvent in getParticipatedEventsForUser(user)

# Make sure an event that is not supposed to be returned isnt
assert Event.get_by_id(1) not in getParticipatedEventsForUser(user)

Expand Down
Loading