Skip to content

Commit

Permalink
Merge pull request #1328 from BCStudentSoftwareDevTeam/User-Profile-E…
Browse files Browse the repository at this point in the history
…vent-Fix

Fix User Profile Events
  • Loading branch information
BrianRamsay authored Aug 30, 2024
2 parents 492e97b + 026f6b8 commit 1daf86c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/logic/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def getUpcomingEventsForUser(user, asOf=datetime.now(), program=None):
if program:
events = events.where(Event.program == program)

events = events.order_by(Event.startDate, Event.name)
events = events.order_by(Event.startDate, Event.timeStart)

events_list = []
shown_recurring_event_list = []
Expand Down
6 changes: 5 additions & 1 deletion app/static/css/userProfile.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
vertical-align: middle;
}

.ongoing-event{
.past-event{
opacity:0.6;
}

.ongoing-event{
background-color: #cdebaa;
}

dt {
font-weight: normal;
padding: 5px;
Expand Down
15 changes: 13 additions & 2 deletions app/templates/main/userProfile.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,26 @@ <h3 class="accordion-header" id="headingOne">
<th scope="col">Event Name</th>
<th scope="col">Event Date</th>
<th nowrap scope="col">Start Time</th>
<th nowrap scope="col">End Time</th>
<th scope="col">Location</th>
<th scope="col">RSVP Status</th>
</thead>
{% for event in upcomingEvents %}
<tr class="{% if event.startDate == currentDateTime.date() and event.timeStart < currentDateTime.time() %} ongoing-event {% endif %}{% if event.startDate == currentDateTime.date() and not event.timeStart < currentDateTime.time() %} bg-info {% endif %}">

{% set eventStatus = 'future-event' %}
{% if event.isPastStart %}
{% set eventStatus = 'ongoing-event' %}
{% endif %}
{% if event.isPastEnd %}
{% set eventStatus = 'past-event' %}
{% endif %}

<tr class="{{ eventStatus }}">
<td>{{event.program.programName if event.program else '--'}}</td>
<td><a href= '/event/{{event.id}}/view' class="link-primary">{{event.name}}</a></td>
<td nowrap>{{event.startDate.strftime('%m/%d/%Y')}}</td>
<td nowrap>{{ '<i>In Progress</i>' | safe if eventStatus == 'ongoing-event' else event.startDate.strftime('%m/%d/%Y') }}</td>
<td nowrap>{{event.timeStart.strftime('%-I:%M %p')}}</td>
<td nowrap>{{event.timeEnd.strftime('%-I:%M %p')}}</td>
<td>{{event.location}}</td>
{% if (event.isRsvpRequired) and (event.id in rsvpedEvents) %}
<td>You have RSVP'd for this event.</td>
Expand Down

0 comments on commit 1daf86c

Please sign in to comment.