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

[Venray #133] Adding a featureflag to allow showing cases without a status #1528

Merged
merged 1 commit into from
Dec 16, 2024
Merged
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
4 changes: 1 addition & 3 deletions src/open_inwoner/cms/cases/views/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ def _get_cases_for_api_group(self, group: ZGWApiGroupConfig) -> list[Zaak]:
)
resolved_cases = self.resolve_cases(raw_cases, group)

filtered_cases = [
case for case in resolved_cases if case.status and is_zaak_visible(case)
]
filtered_cases = [case for case in resolved_cases if is_zaak_visible(case)]
filtered_cases.sort(key=lambda case: case.startdatum, reverse=True)
return filtered_cases

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.16 on 2024-12-11 19:18

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
(
"openzaak",
"0058_remove_zaaktypeconfig_unique_identificatie_in_catalogus_and_more",
),
]

operations = [
migrations.AddField(
model_name="openzaakconfig",
name="show_cases_without_status",
field=models.BooleanField(
default=False,
verbose_name="By default cases are only shown if they have a status set.",
),
),
]
5 changes: 5 additions & 0 deletions src/open_inwoner/openzaak/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ def form_service(self, service):
default=False,
)

show_cases_without_status = models.BooleanField(
verbose_name=_("By default cases are only shown if they have a status set."),
default=False,
)

title_text = models.TextField(
verbose_name=_("Title text"),
help_text=_(
Expand Down
6 changes: 6 additions & 0 deletions src/open_inwoner/openzaak/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ def test_is_zaak_visible(self):
# resolve the zaaktype
zaak.zaaktype = zaaktype

with self.subTest("normal visible without status"):
self.assertFalse(is_zaak_visible(zaak))

config.show_cases_without_status = True
config.save()

with self.subTest("normal visible"):
self.assertTrue(is_zaak_visible(zaak))

Expand Down
3 changes: 3 additions & 0 deletions src/open_inwoner/openzaak/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def is_zaak_visible(zaak: Zaak) -> bool:
if isinstance(zaak.zaaktype, str):
raise ValueError("expected zaak.zaaktype to be resolved from url to model")

if not zaak.status and not config.show_cases_without_status:
return False

if not zaak.zaaktype or zaak.zaaktype.indicatie_intern_of_extern != "extern":
return False

Expand Down
Loading