Skip to content

Conversation

gabeweng
Copy link
Contributor

@gabeweng gabeweng commented Apr 13, 2025

We want to keep track of ownership requests that are accepted or denied as opposed to deleting them when they are handled. This is done by replacing the "withdrawn" field with a "status" field, which can be PENDING, WITHDRAWN, ACCEPTED, or DENIED.

@gabeweng gabeweng requested a review from Copilot April 13, 2025 18:45
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

backend/clubs/models.py:1129

  • [nitpick] Consider adding a clarifying comment on the design rationale for retaining the 'withdrawn' field in MembershipRequest while replacing it with a 'status' field in OwnershipRequest to help future maintainers understand the distinction.
+    withdrawn = models.BooleanField(default=False)

@gabeweng gabeweng marked this pull request as ready for review April 25, 2025 22:02
Copy link
Member

@aviupadhyayula aviupadhyayula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for taking the initiative on this Gabe. Left a couple comments.

Also, is this compatible with @beladelgado2's work in #815? If not, let's add the necessary frontend changes to this PR before merging.

Comment on lines 4394 to 4396
request_instance = OwnershipRequest.objects.filter(
club__code=club, requester=request.user
).first()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: would prefer obj.

Comment on lines +4503 to +4504
request_object.status = OwnershipRequest.ACCEPTED
request_object.save(update_fields=["status"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized: do we update requesters when the status of their request is updated? Feels like we should do that (if we don't already).

Copy link

codecov bot commented Sep 14, 2025

Codecov Report

❌ Patch coverage is 98.14815% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.69%. Comparing base (d2eda0a) to head (69ece3b).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
backend/clubs/views.py 96.55% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #812      +/-   ##
==========================================
+ Coverage   74.54%   74.69%   +0.14%     
==========================================
  Files          33       33              
  Lines        7831     7875      +44     
==========================================
+ Hits         5838     5882      +44     
  Misses       1993     1993              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -284,3 +286,210 @@ def test_send_mail_retry_logic(self):
)

self.assertEqual(mocked_send.call_count, 3)


class OwnershipRequestTestCase(TestCase):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I'm not sure how necessary it is to test the business logic in both model unit tests and view tests. If I get the go-ahead I will probably just delete all of these model tests.

@gabeweng
Copy link
Contributor Author

FYI currently this is compatible with the front end, but there is also backend functionality that isn't used in the frontend (withdrawing your own requests, club owners seeing and handling requests to their clubs). I don't think this is very likely to be used anyway though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants