Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Make it easy for staff to close rounds & filter on unpublished rounds #3869

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions hypha/apply/funds/models/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@ def open(self):
return rounds

def closed(self):
rounds = self.live().public().specific()
rounds = rounds.filter(end_date__lt=date.today())
return rounds
rounds = self.public()
ended_rounds = rounds.live().specific().filter(end_date__lt=date.today())
unpublished_rounds = rounds.not_live().specific()
return ended_rounds | unpublished_rounds


class RoundBase(WorkflowStreamForm, SubmittableStreamForm): # type: ignore
Expand Down Expand Up @@ -685,7 +686,9 @@ def open(self):
)

def closed(self):
return self.filter(end_date__lt=date.today())
closed = self.filter(end_date__lt=date.today())
unpublished = self.not_live().specific()
return closed | unpublished

def by_lead(self, user):
return self.filter(lead_pk=user.pk)
Expand Down
6 changes: 6 additions & 0 deletions hypha/apply/funds/tests/models/test_roundsandlabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ def test_closed(self):
fetched_obj = RoundsAndLabs.objects.closed().first()
self.assertEqual(fetched_obj, round)

def test_unpublished(self):
round = self.base_factory()
round.unpublish()
fetched_obj = RoundsAndLabs.objects.closed().first()
self.assertEqual(fetched_obj, round)

def test_open(self):
obj = self.base_factory(now=True)
fetched_obj = RoundsAndLabs.objects.open().first()
Expand Down
Loading