From 0ec884d365504ae4498d0a67b107f9898376649c Mon Sep 17 00:00:00 2001 From: Amit Upreti Date: Wed, 8 Mar 2023 11:55:38 -0500 Subject: [PATCH 01/10] display data for the inactive participants --- .../templates/events/event_entries.html | 97 +++++++++++++------ .../templatetags/participation_status.py | 10 ++ 2 files changed, 77 insertions(+), 30 deletions(-) diff --git a/physionet-django/events/templates/events/event_entries.html b/physionet-django/events/templates/events/event_entries.html index 60d0135bd0..6b49590669 100644 --- a/physionet-django/events/templates/events/event_entries.html +++ b/physionet-django/events/templates/events/event_entries.html @@ -1,30 +1,67 @@ -
- - - - - - - - - - - - {% for participant in event.participants.all %} - - - - - - - - {% endfor %} - -
UsernameFull nameEmailCredentialedCohost
{{ participant.user.username }}{{ participant.user.get_full_name }}{{ participant.user.email }}{{ participant.user.get_credentialing_status }} - {% if participant.is_cohost %} - - {% else %} - - {% endif %} -
-
+{% load participation_status %} + + diff --git a/physionet-django/events/templatetags/participation_status.py b/physionet-django/events/templatetags/participation_status.py index b1e4d3b91b..9f1e8211c9 100644 --- a/physionet-django/events/templatetags/participation_status.py +++ b/physionet-django/events/templatetags/participation_status.py @@ -23,3 +23,13 @@ def is_on_waiting_list(user, event): @register.filter(name='has_access_to_event_dataset') 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 + ] + ) From 937f55bfa9f0b6fffb9a72fba68bae7a324c230d Mon Sep 17 00:00:00 2001 From: rutvikrj26 Date: Wed, 4 Oct 2023 16:26:44 -0400 Subject: [PATCH 02/10] Implemented the individual tabs (Karol's idea), both in console and the main events page. --- .../templates/console/event_management.html | 99 ++++++++++++++++++- .../templates/events/event_entries.html | 32 ------ .../events/templates/events/event_home.html | 44 ++++++++- .../events/event_pending_applications.html | 31 ++++++ .../events/event_rejected_applications.html | 31 ++++++ .../events/event_withdrawn_applications.html | 31 ++++++ .../templatetags/participation_status.py | 21 ++++ 7 files changed, 254 insertions(+), 35 deletions(-) create mode 100644 physionet-django/events/templates/events/event_pending_applications.html create mode 100644 physionet-django/events/templates/events/event_rejected_applications.html create mode 100644 physionet-django/events/templates/events/event_withdrawn_applications.html diff --git a/physionet-django/console/templates/console/event_management.html b/physionet-django/console/templates/console/event_management.html index 1ec760e079..525a57df1f 100644 --- a/physionet-django/console/templates/console/event_management.html +++ b/physionet-django/console/templates/console/event_management.html @@ -46,11 +46,51 @@

{{ event.title }}

+ data-target="#participants">View
+
+
Pending Applications:
+
+
+
{{ event.participants.count }}
+
+ +
+
+
+
+
+
Rejected Applications:
+
+
+
{{ event.participants.count }}
+
+ +
+
+
+
+
+
Withdrawn Applications:
+
+
+
{{ event.participants.count }}
+
+ +
+
+
+
+
Description:
{{ event.description }}
@@ -59,7 +99,7 @@

{{ event.title }}

{% include 'console/event_management_manage_dataset.html' %} + + + + {% endblock %} diff --git a/physionet-django/events/templates/events/event_entries.html b/physionet-django/events/templates/events/event_entries.html index 6b49590669..3fc91e2ce1 100644 --- a/physionet-django/events/templates/events/event_entries.html +++ b/physionet-django/events/templates/events/event_entries.html @@ -1,10 +1,4 @@ {% load participation_status %} - diff --git a/physionet-django/events/templates/events/event_home.html b/physionet-django/events/templates/events/event_home.html index bd62b980eb..e0e5513e9b 100644 --- a/physionet-django/events/templates/events/event_home.html +++ b/physionet-django/events/templates/events/event_home.html @@ -86,6 +86,9 @@

{{ event.title }}

Share the class code: {{ url_prefix }}{% url 'event_detail' event.slug %}

+ + + Edit Event {% endif %} @@ -114,7 +117,46 @@ - {% endfor %} + + + + {% endfor %} {% endif %} diff --git a/physionet-django/events/templates/events/event_pending_applications.html b/physionet-django/events/templates/events/event_pending_applications.html new file mode 100644 index 0000000000..651be2d6af --- /dev/null +++ b/physionet-django/events/templates/events/event_pending_applications.html @@ -0,0 +1,31 @@ +{% load participation_status %} + \ 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 new file mode 100644 index 0000000000..66168ece86 --- /dev/null +++ b/physionet-django/events/templates/events/event_rejected_applications.html @@ -0,0 +1,31 @@ +{% load participation_status %} + \ 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 new file mode 100644 index 0000000000..2769601437 --- /dev/null +++ b/physionet-django/events/templates/events/event_withdrawn_applications.html @@ -0,0 +1,31 @@ +{% load participation_status %} + \ 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 9f1e8211c9..67c2551c91 100644 --- a/physionet-django/events/templatetags/participation_status.py +++ b/physionet-django/events/templatetags/participation_status.py @@ -33,3 +33,24 @@ def get_inactive_applications(event): 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] + ) From 2c7677bc3480a2bab1c47c89890acb2bbbe94cb7 Mon Sep 17 00:00:00 2001 From: rutvikrj26 Date: Wed, 1 Nov 2023 17:11:01 -0400 Subject: [PATCH 03/10] Rebased onto dev --- .../templates/console/event_management.html | 125 +++--------------- physionet-django/console/views.py | 43 +++++- .../templates/events/event_applications.html | 36 +++++ .../events/templates/events/event_home.html | 70 +++------- .../events/event_pending_applications.html | 31 ----- .../events/event_rejected_applications.html | 31 ----- .../events/event_withdrawn_applications.html | 31 ----- .../templatetags/participation_status.py | 32 +---- physionet-django/events/views.py | 39 ++++++ 9 files changed, 159 insertions(+), 279 deletions(-) create mode 100644 physionet-django/events/templates/events/event_applications.html delete mode 100644 physionet-django/events/templates/events/event_pending_applications.html delete mode 100644 physionet-django/events/templates/events/event_rejected_applications.html delete mode 100644 physionet-django/events/templates/events/event_withdrawn_applications.html diff --git a/physionet-django/console/templates/console/event_management.html b/physionet-django/console/templates/console/event_management.html index 525a57df1f..cb525d09f6 100644 --- a/physionet-django/console/templates/console/event_management.html +++ b/physionet-django/console/templates/console/event_management.html @@ -38,137 +38,54 @@

{{ event.title }}

{% endif %} + + {% for option in status_options %}
-
Total participants:
-
-
-
{{ event.participants.count }}
-
- -
-
-
-
-
-
Pending Applications:
-
-
-
{{ event.participants.count }}
-
- -
-
-
-
-
-
Rejected Applications:
-
-
-
{{ event.participants.count }}
-
- -
-
-
-
-
-
Withdrawn Applications:
+
{{ option.title }}
-
{{ event.participants.count }}
+
{{ option.count }}
+ data-target="#{{ option.id }}">View
+ {% endfor %}
Description:
{{ event.description }}
+ {% include 'console/event_management_manage_dataset.html' %} + + {% for option in status_options %} - - - + {% endfor %} {% endblock %} diff --git a/physionet-django/console/views.py b/physionet-django/console/views.py index 12991c989d..0567e0fa5d 100644 --- a/physionet-django/console/views.py +++ b/physionet-django/console/views.py @@ -5,6 +5,7 @@ from collections import OrderedDict from datetime import datetime from itertools import chain +import stat from statistics import StatisticsError, median import notification.utility as notification @@ -28,7 +29,7 @@ from django.utils import timezone from django.core.exceptions import PermissionDenied from events.forms import EventAgreementForm, EventDatasetForm -from events.models import Event, EventAgreement, EventDataset +from events.models import Event, EventAgreement, EventDataset, EventApplication from notification.models import News from physionet.forms import set_saved_fields_cookie from physionet.middleware.maintenance import ServiceUnavailable @@ -3011,7 +3012,42 @@ def event_management(request, event_slug): else: event_dataset_form = EventDatasetForm() + 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_datasets = selected_event.datasets.filter(is_active=True) + status_options = [ + { + '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, + }, + ] + return render( request, 'console/event_management.html', @@ -3019,6 +3055,11 @@ def event_management(request, event_slug): 'event': selected_event, 'event_dataset_form': event_dataset_form, 'event_datasets': event_datasets, + 'status_options': status_options, + 'participants': participants, + 'pending_applications': pending_applications, + 'rejected_applications': rejected_applications, + 'withdrawn_applications': withdrawn_applications, }) diff --git a/physionet-django/events/templates/events/event_applications.html b/physionet-django/events/templates/events/event_applications.html new file mode 100644 index 0000000000..52a5cc3ec9 --- /dev/null +++ b/physionet-django/events/templates/events/event_applications.html @@ -0,0 +1,36 @@ +{% load participation_status %} + diff --git a/physionet-django/events/templates/events/event_home.html b/physionet-django/events/templates/events/event_home.html index e0e5513e9b..962c5bcfa3 100644 --- a/physionet-django/events/templates/events/event_home.html +++ b/physionet-django/events/templates/events/event_home.html @@ -85,10 +85,10 @@

{{ event.title }}

{% if event.host == user %} Share the class code: {{ url_prefix }}{% url 'event_detail' event.slug %}

- - - - + + + + Edit Event {% endif %} @@ -103,61 +103,25 @@

{{ event.title }}


{% if events_active %} - {% for event in events_active %} - - {% for option in status_options %} + {% for info in applicant_info %}
-
{{ option.title }}
+
{{ info.title }}
-
{{ option.count }}
+
{{ info.count }}
+ data-target="#{{ info.id }}">View
@@ -64,17 +64,17 @@

{{ event.title }}

{% include 'console/event_management_manage_dataset.html' %} - {% for option in status_options %} + {% for info in applicant_info %}