Skip to content

Commit

Permalink
Merge branch 'master' into version-upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
rm03 committed Jan 22, 2024
2 parents 3e00d64 + 501dd0a commit f23ff2d
Show file tree
Hide file tree
Showing 18 changed files with 756 additions and 179 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Python files
__pycache__/
*.pyc
.python-version

# Distribution
/frontend/public/storybook/
Expand All @@ -27,6 +28,8 @@ db.sqlite3

# React
node_modules/
.yarn
.yarnrc.yml
.next/

# Development Enviroment
Expand Down
10 changes: 10 additions & 0 deletions backend/clubs/management/commands/populate.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ def get_image(url):
tag_undergrad, _ = Tag.objects.get_or_create(name="Undergraduate")
tag_generic, _ = Tag.objects.get_or_create(name="Generic")

wharton_badge, _ = Badge.objects.get_or_create(
label="Wharton Council",
purpose="Dummy badge to mock Wharton-affiliated clubs",
visible=True,
)

for i in range(1, 50):
club, created = Club.objects.get_or_create(
code="z-club-{}".format(i),
Expand All @@ -406,6 +412,10 @@ def get_image(url):
},
)

if 10 <= i <= 15:
# Make some clubs Wharton-affiliated
club.badges.add(wharton_badge)

if created:
club.available_virtually = i % 2 == 0
club.appointment_needed = i % 3 == 0
Expand Down
167 changes: 0 additions & 167 deletions backend/clubs/management/commands/wharton_council_application.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.18 on 2023-11-17 22:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("clubs", "0090_auto_20230106_1443"),
]

operations = [
migrations.AddField(
model_name="clubapplication",
name="application_end_time_exception",
field=models.BooleanField(blank=True, default=False),
),
]
13 changes: 13 additions & 0 deletions backend/clubs/migrations/0092_merge_20240106_1117.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 3.2.18 on 2024-01-06 16:17

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("clubs", "0091_applicationextension"),
("clubs", "0091_clubapplication_application_end_time_exception"),
]

operations = []
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.18 on 2024-01-06 16:19
# Generated by Django 3.2.18 on 2024-01-06 16:53

from django.conf import settings
from django.db import migrations
Expand All @@ -7,7 +7,7 @@
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("clubs", "0091_applicationextension"),
("clubs", "0092_merge_20240106_1117"),
]

operations = [
Expand Down
18 changes: 18 additions & 0 deletions backend/clubs/migrations/0094_applicationcycle_release_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.18 on 2024-01-11 14:39

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("clubs", "0093_auto_20240106_1153"),
]

operations = [
migrations.AddField(
model_name="applicationcycle",
name="release_date",
field=models.DateTimeField(null=True),
),
]
2 changes: 2 additions & 0 deletions backend/clubs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,7 @@ class ApplicationCycle(models.Model):
name = models.CharField(max_length=255)
start_date = models.DateTimeField(null=True)
end_date = models.DateTimeField(null=True)
release_date = models.DateTimeField(null=True)

def __str__(self):
return self.name
Expand All @@ -1551,6 +1552,7 @@ class ClubApplication(CloneModel):
description = models.TextField(blank=True)
application_start_time = models.DateTimeField()
application_end_time = models.DateTimeField()
application_end_time_exception = models.BooleanField(default=False, blank=True)
name = models.TextField(blank=True)
result_release_time = models.DateTimeField()
application_cycle = models.ForeignKey(
Expand Down
26 changes: 25 additions & 1 deletion backend/clubs/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
AdminNote,
Advisor,
ApplicationCommittee,
ApplicationCycle,
ApplicationExtension,
ApplicationMultipleChoice,
ApplicationQuestion,
Expand Down Expand Up @@ -97,6 +98,28 @@ def save(self):
return super().save()


class ApplicationCycleSerializer(serializers.ModelSerializer):
class Meta:
model = ApplicationCycle
fields = ["id", "name", "start_date", "end_date", "release_date"]

def validate(self, data):
"""
Check that start_date <= end_date <= release_date
"""
start_date = data.get("start_date")
end_date = data.get("end_date")
release_date = data.get("release_date")

if start_date and end_date and start_date >= end_date:
raise serializers.ValidationError("Start must be before end.")

if end_date and release_date and end_date >= release_date:
raise serializers.ValidationError("End must be before release.")

return data


class TagSerializer(serializers.ModelSerializer):
clubs = serializers.IntegerField(read_only=True)

Expand Down Expand Up @@ -1011,6 +1034,7 @@ class Meta:
"is_favorite",
"is_member",
"is_subscribe",
"is_wharton",
"membership_count",
"recruiting_cycle",
"name",
Expand Down Expand Up @@ -1663,7 +1687,6 @@ class Meta(ClubListSerializer.Meta):
"instagram",
"is_ghost",
"is_request",
"is_wharton",
"linkedin",
"listserv",
"members",
Expand Down Expand Up @@ -2804,6 +2827,7 @@ class Meta:
"rejection_email",
"application_start_time",
"application_end_time",
"application_end_time_exception",
"result_release_time",
"external_url",
"committees",
Expand Down
16 changes: 11 additions & 5 deletions backend/clubs/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
UserZoomAPIView,
WhartonApplicationAPIView,
WhartonApplicationStatusAPIView,
WhartonCyclesView,
YearViewSet,
email_preview,
)
Expand Down Expand Up @@ -78,6 +79,16 @@
router.register(
r"external/members/(?P<code>.+)", ExternalMemberListViewSet, basename="external"
)
router.register(
r"cycles",
WhartonCyclesView,
basename="wharton-applications-create",
)
router.register(
r"whartonapplications",
WhartonApplicationAPIView,
basename="wharton",
)
router.register(r"submissions", ApplicationSubmissionUserViewSet, basename="submission")

clubs_router = routers.NestedSimpleRouter(router, r"clubs", lookup="club")
Expand Down Expand Up @@ -156,11 +167,6 @@
MeetingZoomWebhookAPIView.as_view(),
name="webhooks-meeting",
),
path(
r"whartonapplications/",
WhartonApplicationAPIView.as_view(),
name="wharton-applications",
),
path(
r"whartonapplications/status/",
WhartonApplicationStatusAPIView.as_view(),
Expand Down
Loading

0 comments on commit f23ff2d

Please sign in to comment.