+ {% for event in events_active %}
+ {% for option in event_details|get_status_options:event.id %}
+
- {% include 'events/event_entries.html' %}
+ {% include 'events/event_applications.html' %}
-
-
-
-
- {% include 'events/event_pending_applications.html' %}
-
-
-
-
-
-
-
- {% include 'events/event_rejected_applications.html' %}
-
-
-
-
-
-
-
- {% include 'events/event_withdrawn_applications.html' %}
-
-
-
- {% endfor %}
+ {% endfor %}
+ {% endfor %}
{% endif %}
+
@@ -195,7 +159,7 @@
{{ event.title }}
{% if event.host == user %}
Share the class code: {{ url_prefix }}{% url 'event_detail' event.slug %}
-
View participants
+
View participants
Edit Event
{% endif %}
@@ -211,20 +175,22 @@
{{ event.title }}
{% if events_past %}
{% for event in events_past %}
-
+ {% for option in event_details|get_status_options:event.id %}
+
- {% include 'events/event_entries.html' %}
+ {% include 'events/event_applications.html' %}
{% endfor %}
+ {% endfor %}
{% endif %}
{% endblock %}
diff --git a/physionet-django/events/templates/events/event_pending_applications.html b/physionet-django/events/templates/events/event_pending_applications.html
deleted file mode 100644
index 651be2d6af..0000000000
--- a/physionet-django/events/templates/events/event_pending_applications.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{% load participation_status %}
-
-
-
-
-
-
- Username
- Full name
- Email
- Credentialed
- Cohost
-
-
-
- {% with pending_applications=event|get_pending_applications %}
- {% for application in pending_applications %}
-
- {{ application.user.username }}
- {{ application.user.get_full_name }}
- {{ application.user.email }}
- {{ application.comment_to_applicant }}
- {{ application.decision_datetime | date }}
-
- {% endfor %}
- {% endwith %}
-
-
-
-
-
\ No newline at end of file
diff --git a/physionet-django/events/templates/events/event_rejected_applications.html b/physionet-django/events/templates/events/event_rejected_applications.html
deleted file mode 100644
index 66168ece86..0000000000
--- a/physionet-django/events/templates/events/event_rejected_applications.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{% load participation_status %}
-
-
-
-
-
-
- Username
- Full name
- Email
- Credentialed
- Cohost
-
-
-
- {% with rejected_applications=event|get_rejected_applications %}
- {% for application in rejected_applications %}
-
- {{ application.user.username }}
- {{ application.user.get_full_name }}
- {{ application.user.email }}
- {{ application.comment_to_applicant }}
- {{ application.decision_datetime | date }}
-
- {% endfor %}
- {% endwith %}
-
-
-
-
-
\ No newline at end of file
diff --git a/physionet-django/events/templates/events/event_withdrawn_applications.html b/physionet-django/events/templates/events/event_withdrawn_applications.html
deleted file mode 100644
index 2769601437..0000000000
--- a/physionet-django/events/templates/events/event_withdrawn_applications.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{% load participation_status %}
-
-
-
-
-
-
- Username
- Full name
- Email
- Credentialed
- Cohost
-
-
-
- {% with withrawn_applications=event|get_withdrawn_applications %}
- {% for application in withdrawn_applications %}
-
- {{ application.user.username }}
- {{ application.user.get_full_name }}
- {{ application.user.email }}
- {{ application.comment_to_applicant }}
- {{ application.decision_datetime | date }}
-
- {% endfor %}
- {% endwith %}
-
-
-
-
-
\ No newline at end of file
diff --git a/physionet-django/events/templatetags/participation_status.py b/physionet-django/events/templatetags/participation_status.py
index 67c2551c91..7084a80771 100644
--- a/physionet-django/events/templatetags/participation_status.py
+++ b/physionet-django/events/templatetags/participation_status.py
@@ -25,32 +25,6 @@ def has_access_to_event_dataset(user, dataset):
return has_access_to_event_dataset_func(user, dataset)
-@register.filter(name='get_inactive_applications')
-def get_inactive_applications(event):
- return event.applications.filter(
- status__in=[
- EventApplication.EventApplicationStatus.NOT_APPROVED,
- EventApplication.EventApplicationStatus.WITHDRAWN
- ]
- )
-
-
-@register.filter(name='get_pending_applications')
-def get_pending_applications(event):
- return event.applications.filter(
- status__in=[EventApplication.EventApplicationStatus.WAITLISTED]
- )
-
-
-@register.filter(name='get_withdrawn_applications')
-def get_withdrawn_applications(event):
- return event.applications.filter(
- status__in=[EventApplication.EventApplicationStatus.WITHDRAWN]
- )
-
-
-@register.filter(name='get_rejected_applications')
-def get_rejected_applications(event):
- return event.applications.filter(
- status__in=[EventApplication.EventApplicationStatus.NOT_APPROVED]
- )
+@register.filter(name='get_status_options')
+def get_status_options(event_details, event_id):
+ return event_details[event_id]
\ No newline at end of file
diff --git a/physionet-django/events/views.py b/physionet-django/events/views.py
index f21eb69797..27f47c4abb 100644
--- a/physionet-django/events/views.py
+++ b/physionet-django/events/views.py
@@ -1,4 +1,5 @@
from datetime import datetime
+import stat
from django.http import JsonResponse
from django.shortcuts import render, get_object_or_404, redirect
@@ -146,6 +147,43 @@ def event_home(request):
else:
form_error = True
+ event_details = {}
+ for selected_event in events_all:
+ participants = selected_event.participants.all()
+ pending_applications = selected_event.applications.filter(
+ status__in=[EventApplication.EventApplicationStatus.WAITLISTED])
+ rejected_applications = selected_event.applications.filter(
+ status__in=[EventApplication.EventApplicationStatus.NOT_APPROVED])
+ withdrawn_applications = selected_event.applications.filter(
+ status__in=[EventApplication.EventApplicationStatus.WITHDRAWN])
+
+ event_details[selected_event.id] = [
+ {
+ 'id': 'participants',
+ 'title': 'Total participants:',
+ 'count': participants.count(),
+ 'objects': participants,
+ },
+ {
+ 'id': 'pending_applications',
+ 'title': 'Pending applications:',
+ 'count': pending_applications.count(),
+ 'objects': pending_applications,
+ },
+ {
+ 'id': 'rejected_applications',
+ 'title': 'Rejected applications:',
+ 'count': rejected_applications.count(),
+ 'objects': rejected_applications,
+ },
+ {
+ 'id': 'withdrawn_applications',
+ 'title': 'Withdrawn applications:',
+ 'count': withdrawn_applications.count(),
+ 'objects': withdrawn_applications,
+ },
+ ]
+
# get all participation requests for Active events where the current user is the host and the participants are
# waiting for a response
participation_requests = EventApplication.objects.filter(
@@ -160,6 +198,7 @@ def event_home(request):
'can_change_event': can_change_event,
'form_error': form_error,
'participation_response_formset': participation_response_formset,
+ 'event_details': event_details,
})
From 8f4ec61d07d806718ed09a8353d8fadf4aec653b Mon Sep 17 00:00:00 2001
From: rutvikrj26
Date: Wed, 11 Oct 2023 13:42:19 -0400
Subject: [PATCH 04/10] styling changes - whitespace
---
physionet-django/events/templatetags/participation_status.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/physionet-django/events/templatetags/participation_status.py b/physionet-django/events/templatetags/participation_status.py
index 7084a80771..d8f90de30d 100644
--- a/physionet-django/events/templatetags/participation_status.py
+++ b/physionet-django/events/templatetags/participation_status.py
@@ -27,4 +27,4 @@ def has_access_to_event_dataset(user, dataset):
@register.filter(name='get_status_options')
def get_status_options(event_details, event_id):
- return event_details[event_id]
\ No newline at end of file
+ return event_details[event_id]
From e5850be40db6beb5c105a2daf2f447c2729cc3fe Mon Sep 17 00:00:00 2001
From: Rutvik Solanki
Date: Wed, 1 Nov 2023 12:01:18 -0400
Subject: [PATCH 05/10] Update the query to be more efficient..
Co-authored-by: Karol Szuster <43988137+kshalot@users.noreply.github.com>
---
physionet-django/events/views.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/physionet-django/events/views.py b/physionet-django/events/views.py
index 27f47c4abb..b18e68802f 100644
--- a/physionet-django/events/views.py
+++ b/physionet-django/events/views.py
@@ -151,7 +151,7 @@ def event_home(request):
for selected_event in events_all:
participants = selected_event.participants.all()
pending_applications = selected_event.applications.filter(
- status__in=[EventApplication.EventApplicationStatus.WAITLISTED])
+ status=EventApplication.EventApplicationStatus.WAITLISTED)
rejected_applications = selected_event.applications.filter(
status__in=[EventApplication.EventApplicationStatus.NOT_APPROVED])
withdrawn_applications = selected_event.applications.filter(
From 66a66895ebb85d7c475f678c9dbd2931d3178d49 Mon Sep 17 00:00:00 2001
From: rutvikrj26
Date: Tue, 7 Nov 2023 08:28:02 -0500
Subject: [PATCH 06/10] Refactored option & status_options to info &
applicant_info
---
.../templates/console/event_management.html | 16 +-
physionet-django/console/views.py | 96 ++++++------
.../templates/events/event_applications.html | 4 +-
.../events/templates/events/event_home.html | 12 +-
.../templatetags/participation_status.py | 16 +-
physionet-django/events/views.py | 141 +++++++++++-------
6 files changed, 165 insertions(+), 120 deletions(-)
diff --git a/physionet-django/console/templates/console/event_management.html b/physionet-django/console/templates/console/event_management.html
index cb525d09f6..4ba78e357a 100644
--- a/physionet-django/console/templates/console/event_management.html
+++ b/physionet-django/console/templates/console/event_management.html
@@ -39,16 +39,16 @@ {{ event.title }}
- {% for option in status_options %}
+ {% for info in applicant_info %}