Skip to content

Commit

Permalink
Revert "Prevent duplicate committee names (#770)"
Browse files Browse the repository at this point in the history
This reverts commit e8b9b54.
  • Loading branch information
aviupadhyayula authored Jan 24, 2025
1 parent e8b9b54 commit d27fa88
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 146 deletions.
91 changes: 0 additions & 91 deletions backend/clubs/management/commands/merge_duplicate_committees.py

This file was deleted.

6 changes: 0 additions & 6 deletions backend/clubs/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2855,12 +2855,6 @@ def save(self):
)
)
)

# Committee names must be unique
normalized_committees = [name.strip().lower() for name in committees]
if len(set(normalized_committees)) != len(normalized_committees):
raise serializers.ValidationError("Committee names must be unique")

if prev_committee_names != committees:
if application_obj.application_start_time < now:
raise serializers.ValidationError(
Expand Down
49 changes: 0 additions & 49 deletions backend/tests/clubs/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from clubs.filters import DEFAULT_PAGE_SIZE
from clubs.models import (
Advisor,
ApplicationCommittee,
ApplicationSubmission,
Asset,
Badge,
Expand Down Expand Up @@ -2938,54 +2937,6 @@ def test_club_approval_response_templates(self):
)
self.assertEqual(resp.status_code, 403)

def test_application_duplicate_committees(self):
"""
Test that duplicate committees are rejected when creating/updating applications.
"""
date = datetime.datetime.now() + datetime.timedelta(days=1)

self.client.login(username=self.user5.username, password="test")

# Test creating new application with duplicates
response = self.client.post(
reverse("club-applications-list", args=(self.club1.code,)),
data={
"name": "Test Application",
"application_start_time": date,
"application_end_time": date + datetime.timedelta(days=7),
"result_release_time": date + datetime.timedelta(days=14),
"committees": [{"name": "General Member"}, {"name": "General Member"}],
},
content_type="application/json",
)

self.assertEqual(response.status_code, 400)
self.assertIn("Committee names must be unique", str(response.content))

# Create valid application for patch test
application = ClubApplication.objects.create(
name="Test Application",
club=self.club1,
application_start_time=date,
application_end_time=date + datetime.timedelta(days=7),
result_release_time=date + datetime.timedelta(days=14),
)
ApplicationCommittee.objects.create(
name="General Member", application=application
)

# Try to update with duplicate committees
response = self.client.patch(
reverse("club-applications-detail", args=(self.club1.code, application.id)),
data={
"committees": [{"name": "General Member"}, {"name": "General Member"}]
},
content_type="application/json",
)

self.assertEqual(response.status_code, 400)
self.assertIn("Committee names must be unique", str(response.content))


class HealthTestCase(TestCase):
def test_health(self):
Expand Down

0 comments on commit d27fa88

Please sign in to comment.