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

Closed rounds should include unpublished rounds #3867

Open
frjo opened this issue Apr 10, 2024 · 1 comment · May be fixed by #3869
Open

Closed rounds should include unpublished rounds #3867

frjo opened this issue Apr 10, 2024 · 1 comment · May be fixed by #3869
Assignees
Labels
Type: Bug Bugs! Things that are broken :-/

Comments

@frjo
Copy link
Contributor

frjo commented Apr 10, 2024

Make all filters include unpublished rounds when search for closed rounds.

This include unpublished rounds:

class OpenRoundFilter(Select2MultipleChoiceFilter):
def __init__(self, *args, **kwargs):
super().__init__(
self,
*args,
choices=[("open", "Open"), ("closed", "Closed"), ("new", "Not Started")],
**kwargs,
)
def filter(self, qs, value):
if value is None or len(value) != 1:
return qs
value = value[0]
if value == "closed":
return qs.closed()
if value == "new":
return qs.new()
return qs.open()

This does not include unpublished rounds:

@login_required
@require_http_methods(["GET"])
def sub_menu_rounds(request):
selected_rounds = request.GET.getlist("round")
selected_fund = request.GET.get("fund")
qs = Round.objects.all()
if selected_fund:
fund = Page.objects.get(id=selected_fund)
qs = Round.objects.child_of(fund)
open_rounds = [
{"id": item.id, "selected": str(item.id) in selected_rounds, "title": str(item)}
for item in qs.open().order_by("-end_date").distinct()
]
closed_rounds = [
{"id": item.id, "selected": str(item.id) in selected_rounds, "title": str(item)}
for item in qs.closed()
.filter(submissions__isnull=False)
.order_by("-end_date")
.distinct()
]
ctx = {
"open_rounds": open_rounds,
"closed_rounds": closed_rounds,
"selected_rounds": selected_rounds,
}
return render(request, "submissions/submenu/rounds.html", ctx)

This does not include unpublished rounds:

class RoundStateListFilter(admin.SimpleListFilter):
title = "state"
parameter_name = "form-state"
def lookups(self, request, model_admin):
return (
("open", _("Open")),
("closed", _("Closed")),
)
def queryset(self, request, queryset):
value = self.value()
if value == "open":
return queryset.open()
elif value == "closed":
return queryset.closed()
return queryset

@frjo frjo added the Type: Bug Bugs! Things that are broken :-/ label Apr 10, 2024
@wes-otf wes-otf self-assigned this Apr 10, 2024
@wes-otf
Copy link
Contributor

wes-otf commented Apr 19, 2024

This is a bit of an odd one the more I dig into it, maybe we need to have a conversation on how we want to define "Closed", "Open" and "Unpublished"? Because on top of the issues that @sandeepsajan0 mentioned in #3869, if you schedule a round ahead of time, that also won't show up in Wagtail under any filter besides All which can be a little unruly to navigate when you have lots of rounds (should we have a Scheduled filter?).

Then there's also issue of making this congruent with labs. If we want staff to stop unpublishing rounds and instead close them via changing end dates as discussed on Monday in the dev standup, it would be a bit confusing to expect them to unpublish a lab when they wanted it unavailable to the public.

I'm almost wondering if it would make more sense to automatically unpublish a round on closing rather than keeping it in a "live" state and change some of the "Unpublish" verbiage to just be "Close". This seems like it would solve for most of the problems listed here, but I'm open to other thoughts! @frjo @sandeepsajan0 @theskumar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bugs! Things that are broken :-/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants