From e1fac0b0bc6f9c8004d1ebcbbf4c2474d990583e Mon Sep 17 00:00:00 2001 From: Avi Upadhyayula <69180850+aviupadhyayula@users.noreply.github.com> Date: Sun, 28 Apr 2024 23:48:30 -0400 Subject: [PATCH] Merge master into ticketing (#687) * fix expires_at test test (#664) * Cast exception to str in management command * Move submissions from /apply to user profile (#638) * finished changes * Remove Wharton applications from user profile (and update branch) (#641) * Update main.ts * Update frontend dependencies (#616) Upgrade from Node 14 to Node 20 and bump frontend dependency versions to current. --------- Co-authored-by: Julian Weng * Update README.md * Update README backend instructions and intro blurb * Fix admin page access on frontend. (#626) Add frontend check for existing pre-loaded permissions on /admin. * Removed deprecated QuestionResponse model and duplicate line (#625) * Remove deprecated QuestionResponse model * remove duplicate line: 'rank field in Club' * made migrations after deleting QuestionResponse * Streamline django storages config (#618) * Add staticfiles * Fix AWS bucket routing for boto * Try setting credentials through env vars * Try renaming env vars? * Set AWS region * add back staticfiles * Remove region and signature version * Move credentials to new API * Use env variables and remove staticfiles * Add back staticfiles * Make code look pretty --------- Co-authored-by: Rohan Moniz <60864468+rm03@users.noreply.github.com> * Add hour to displayed application deadline (#628) * Add hour for application due dates * Make linter happy * Specify Eastern time zone * Display username if name is empty (#637) * finished changes * Remove Wharton applications from user profile * Fix weird artifacts from merge --------- Co-authored-by: Joy Liu <34288846+joyliu-q@users.noreply.github.com> Co-authored-by: Julian Weng Co-authored-by: Rohan Moniz <60864468+rm03@users.noreply.github.com> Co-authored-by: Thomas Ngulube <47449914+Porcupine1@users.noreply.github.com> Co-authored-by: Owen Lester * Bump debounce timeout to 400ms (#640) * Bump debounce timeout to 400ms * Make linter happy * small changes * added type * merging * deleted file --------- Co-authored-by: Avi Upadhyayula <69180850+aviupadhyayula@users.noreply.github.com> Co-authored-by: Joy Liu <34288846+joyliu-q@users.noreply.github.com> Co-authored-by: Julian Weng Co-authored-by: Rohan Moniz <60864468+rm03@users.noreply.github.com> Co-authored-by: Thomas Ngulube <47449914+Porcupine1@users.noreply.github.com> * Add carousel (#622) * add carousel * Old react-multi-carousel * fixed npm yarn * remvoed packagelock.json * fixing issues * change height * minor changes * deleted a comment * merging? * delete one onClick * change breakpoint * Revert "Move submissions from /apply to user profile (#638)" (#673) This reverts commit 29d9a123d52ffe79ee5574b82127d240c2b24219. * Revert "Add carousel (#622)" (#674) This reverts commit fcab615cb01cbd51203df0d3d04b432f115789b5. * Improve error reporting in mgmt cmds (#678) * Fix bug in Excel column names (#683) * Remove unused `tickets_count` field --------- Co-authored-by: Thomas Ngulube <47449914+Porcupine1@users.noreply.github.com> Co-authored-by: owlester12 <64493239+owlester12@users.noreply.github.com> Co-authored-by: Joy Liu <34288846+joyliu-q@users.noreply.github.com> Co-authored-by: Julian Weng Co-authored-by: Rohan Moniz <60864468+rm03@users.noreply.github.com> --- .../management/commands/expire_membership_invites.py | 6 ++++-- .../clubs/management/commands/find_broken_images.py | 2 ++ .../clubs/management/commands/update_club_counts.py | 9 +++++---- backend/clubs/models.py | 4 ---- backend/clubs/serializers.py | 2 ++ backend/tests/clubs/test_views.py | 10 ++++------ 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/backend/clubs/management/commands/expire_membership_invites.py b/backend/clubs/management/commands/expire_membership_invites.py index ba76164a7..7ffbae994 100644 --- a/backend/clubs/management/commands/expire_membership_invites.py +++ b/backend/clubs/management/commands/expire_membership_invites.py @@ -1,3 +1,5 @@ +import traceback + from django.core.management.base import BaseCommand from django.utils import timezone @@ -17,10 +19,10 @@ def handle(self, *args, **kwargs): self.stdout.write( self.style.SUCCESS("Successfully marked all stale invites as expired!") ) - except Exception as e: + except Exception: self.stdout.write( self.style.ERROR( "An error was encountered while expiring stale membership invites!" ) ) - self.stdout.write(e) + self.stdout.write(self.style.ERROR(traceback.format_exc())) diff --git a/backend/clubs/management/commands/find_broken_images.py b/backend/clubs/management/commands/find_broken_images.py index 8c2397049..03c01e330 100644 --- a/backend/clubs/management/commands/find_broken_images.py +++ b/backend/clubs/management/commands/find_broken_images.py @@ -1,4 +1,5 @@ import os +import traceback import requests from django.conf import settings @@ -41,6 +42,7 @@ def handle(self, *args, **kwargs): "{} has broken image {}".format(club.code, club.image.url) ) ) + self.stdout.write(self.style.ERROR(traceback.format_exc())) if not self.dry_run: club.image.delete(save=True) broken_list.append( diff --git a/backend/clubs/management/commands/update_club_counts.py b/backend/clubs/management/commands/update_club_counts.py index 01ff17676..69640747b 100644 --- a/backend/clubs/management/commands/update_club_counts.py +++ b/backend/clubs/management/commands/update_club_counts.py @@ -1,3 +1,5 @@ +import traceback + from django.core.management.base import BaseCommand from django.db.models import Count, Q @@ -26,11 +28,10 @@ def handle(self, *args, **kwargs): "Successfully updated all club favorite and membership counts!" ) ) - except Exception as e: + except Exception: self.stdout.write( self.style.ERROR( - "An error was encountered while updating" - + "club favorite and membership counts!" + "Error while updating club favorite & membership counts!" ) ) - self.stdout.write(e) + self.stdout.write(self.style.ERROR(traceback.format_exc())) diff --git a/backend/clubs/models.py b/backend/clubs/models.py index 257848ac7..238984a2d 100644 --- a/backend/clubs/models.py +++ b/backend/clubs/models.py @@ -956,10 +956,6 @@ def create_thumbnail(self, request=None): def __str__(self): return self.name - @property - def tickets_count(self): - return Ticket.objects.count(event=self) - class Favorite(models.Model): """ diff --git a/backend/clubs/serializers.py b/backend/clubs/serializers.py index 04d1d70ab..496b7566b 100644 --- a/backend/clubs/serializers.py +++ b/backend/clubs/serializers.py @@ -2338,6 +2338,8 @@ def get_xlsx_column_name(key): label = json.loads(fair.questions)[index]["label"] return f"[{fair.name}] {label}" return f"Registered for {fair.name}" + else: + return key class Meta(AuthenticatedClubSerializer.Meta): pass diff --git a/backend/tests/clubs/test_views.py b/backend/tests/clubs/test_views.py index 6ddc03be0..0750c611b 100644 --- a/backend/tests/clubs/test_views.py +++ b/backend/tests/clubs/test_views.py @@ -1688,14 +1688,12 @@ def test_send_invite_with_acceptance_email(self): expiry_date = now + timezone.timedelta(days=5) # Compare the expiry dates excluding microseconds - self.assertEqual( - invite1.expires_at.replace(microsecond=0), - expiry_date.replace(microsecond=0), + self.assertLessEqual( + abs(invite1.expires_at - expiry_date), timezone.timedelta(minutes=5) ) - self.assertEqual( - invite2.expires_at.replace(microsecond=0), - expiry_date.replace(microsecond=0), + self.assertLessEqual( + abs(invite2.expires_at - expiry_date), timezone.timedelta(minutes=5) ) # Check that applicants not accepted are not invited