From cff683f2f643653edaebbf84d5397054a7c9999c Mon Sep 17 00:00:00 2001 From: rutvikrj26 Date: Tue, 7 Nov 2023 09:32:52 -0500 Subject: [PATCH] addressing comments on imports & naming --- physionet-django/console/views.py | 14 +++++--------- physionet-django/events/views.py | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/physionet-django/console/views.py b/physionet-django/console/views.py index d8d2d334ba..afcb8df628 100644 --- a/physionet-django/console/views.py +++ b/physionet-django/console/views.py @@ -5,7 +5,6 @@ from collections import OrderedDict from datetime import datetime from itertools import chain -import stat from statistics import StatisticsError, median import notification.utility as notification @@ -2989,14 +2988,11 @@ def event_management(request, event_slug): if "add-event-dataset" in request.POST.keys(): event_dataset_form = EventDatasetForm(request.POST) if event_dataset_form.is_valid(): - if ( - selected_event.datasets.filter( - dataset=event_dataset_form.cleaned_data["dataset"], - access_type=event_dataset_form.cleaned_data["access_type"], - is_active=True, - ).count() - == 0 - ): + active_datasets = selected_event.datasets.filter( + dataset=event_dataset_form.cleaned_data["dataset"], + access_type=event_dataset_form.cleaned_data["access_type"], + is_active=True) + if len(active_datasets) == 0: event_dataset_form.instance.event = selected_event event_dataset_form.save() messages.success( diff --git a/physionet-django/events/views.py b/physionet-django/events/views.py index 6c247f3755..d4d8e1a1b9 100644 --- a/physionet-django/events/views.py +++ b/physionet-django/events/views.py @@ -3,7 +3,7 @@ from django.http import JsonResponse from django.shortcuts import render, get_object_or_404, redirect from django.contrib import messages -from django.db.models import Q, Prefetch +from django.db.models import Q from django.contrib.auth.decorators import login_required from django.forms import modelformset_factory from django.urls import reverse @@ -168,19 +168,19 @@ def event_home(request): for selected_event in events_all: all_applications = selected_event.applications.all() pending_applications = [ - app - for app in all_applications - if app.status == EventApplication.EventApplicationStatus.WAITLISTED + application + for application in all_applications + if application.status == EventApplication.EventApplicationStatus.WAITLISTED ] rejected_applications = [ - app - for app in all_applications - if app.status == EventApplication.EventApplicationStatus.NOT_APPROVED + application + for application in all_applications + if application.status == EventApplication.EventApplicationStatus.NOT_APPROVED ] withdrawn_applications = [ - app - for app in all_applications - if app.status == EventApplication.EventApplicationStatus.WITHDRAWN + application + for application in all_applications + if application.status == EventApplication.EventApplicationStatus.WITHDRAWN ] event_details[selected_event.id] = [