Skip to content

Commit

Permalink
Reflect model change to penndata
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-Jess committed Nov 17, 2024
1 parent ce3b77b commit 0c88430
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions backend/penndata/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,11 @@ def get(self, request):

cells = []

# adds laundry preference to home, defaults to Bishop if no preference
# adds laundry preference to home, defaults to 0 if no preference
# TODO: This defaults to a nonexistent room, not sure if that's problematic
laundry_preference = profile.laundry_preferences.first()
if laundry_preference:
cells.append(self.Cell("laundry", {"room_id": laundry_preference.hall_id}, 5))
cells.append(self.Cell("laundry", {"room_id": laundry_preference.room_id}, 5))
else:
cells.append(self.Cell("laundry", {"room_id": 0}, 5))

Expand Down
8 changes: 4 additions & 4 deletions backend/tests/penndata/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ def test_first_response(self):
self.test_user.profile.dining_preferences.add(Venue.objects.get(venue_id=1733))
self.test_user.profile.dining_preferences.add(Venue.objects.get(venue_id=638))

self.test_user.profile.laundry_preferences.add(LaundryRoom.objects.get(hall_id=3))
self.test_user.profile.laundry_preferences.add(LaundryRoom.objects.get(hall_id=4))
self.test_user.profile.laundry_preferences.add(LaundryRoom.objects.get(hall_id=5))
self.test_user.profile.laundry_preferences.add(LaundryRoom.objects.get(room_id=14089))
self.test_user.profile.laundry_preferences.add(LaundryRoom.objects.get(room_id=14099))
self.test_user.profile.laundry_preferences.add(LaundryRoom.objects.get(room_id=14100))

new_response = self.client.get(reverse("homepage"))
new_res_json = json.loads(new_response.content)["cells"]
Expand All @@ -132,7 +132,7 @@ def test_first_response(self):
self.assertIn(1733, new_dining_info)
self.assertIn(638, new_dining_info)

self.assertEqual(new_res_json[2]["info"]["room_id"], 3)
self.assertEqual(new_res_json[2]["info"]["room_id"], 14089)

self.assertEqual(new_res_json[1]["type"], "news")

Expand Down

0 comments on commit 0c88430

Please sign in to comment.