Skip to content

Commit

Permalink
Merge branch 'master' into stored_favorite_membership_counts
Browse files Browse the repository at this point in the history
  • Loading branch information
shiva-menta committed Feb 2, 2024
2 parents 77d5e8d + 1f34b8b commit a0e4c8b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
12 changes: 8 additions & 4 deletions backend/clubs/serializers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import datetime
import json
import re
from collections import OrderedDict
from urllib.parse import parse_qs, urlparse

import bleach
import pytz
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.cache import cache
Expand Down Expand Up @@ -2748,6 +2746,12 @@ def get_image_url(self, obj):
def validate(self, data):
acceptance_template = data.get("acceptance_email", "")
rejection_template = data.get("rejection_email", "")
request = self.context["request"].data

if "committees" in request and data["application_start_time"] < timezone.now():
raise serializers.ValidationError(
"You cannot edit committees once the application is open"
)

if not ClubApplication.validate_template(
acceptance_template
Expand Down Expand Up @@ -2788,7 +2792,7 @@ def save(self):
request = self.context["request"].data

# only allow modifications to committees if the application is not yet open
now = pytz.timezone("America/New_York").localize(datetime.datetime.now())
now = timezone.now()
if "committees" in request and application_obj.application_start_time > now:
committees = map(
lambda x: x["value"] if "value" in x else x["name"],
Expand All @@ -2798,11 +2802,11 @@ def save(self):
application=application_obj
)
# nasty hack for idempotency
prev_committee_names = prev_committees.values("name")
for prev_committee in prev_committees:
if prev_committee.name not in committees:
prev_committee.delete()

prev_committee_names = prev_committees.values("name")
for name in committees:
if name not in prev_committee_names:
ApplicationCommittee.objects.create(
Expand Down
3 changes: 1 addition & 2 deletions frontend/components/ClubPage/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ const Actions = ({
<div className={className} style={style}>
<Wrapper>
{SHOW_MEMBERSHIP_REQUEST &&
!inClub &&
club.members.length > 0 &&
isMembershipOpen &&
club.accepting_members && (
Expand All @@ -293,7 +292,7 @@ const Actions = ({
updateRequests={updateRequests}
/>
)}
{SHOW_APPLICATIONS && (
{SHOW_APPLICATIONS && !isMembershipOpen && club.accepting_members && (
<Link
href={CLUB_APPLY_ROUTE()}
as={CLUB_APPLY_ROUTE(code)}
Expand Down
2 changes: 1 addition & 1 deletion frontend/utils/branding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const sites = {
// enable showing members for each club
SHOW_MEMBERS: false,
// enable the membership request feature
SHOW_MEMBERSHIP_REQUEST: false,
SHOW_MEMBERSHIP_REQUEST: true,
// show the links to the ranking algorithm from various parts of the site
SHOW_RANK_ALGORITHM: true,
// show the link to the Penn accessibility help page at the bottom of each page
Expand Down
4 changes: 2 additions & 2 deletions k8s/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class MyChart extends PennLabsChart {
new DjangoApplication(this, 'django-wsgi', {
deployment: {
image: backendImage,
replicas: 7,
replicas: 9,
secret: clubsSecret,
env: [
{ name: 'REDIS_HOST', value: 'penn-clubs-redis' },
Expand Down Expand Up @@ -60,7 +60,7 @@ export class MyChart extends PennLabsChart {
new ReactApplication(this, 'react', {
deployment: {
image: frontendImage,
replicas: 3,
replicas: 5,
},
domain: { host: clubsDomain, paths: ['/'] },
port: 80,
Expand Down

0 comments on commit a0e4c8b

Please sign in to comment.