-
Notifications
You must be signed in to change notification settings - Fork 6
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
[#2645] Filter cases by status #1331
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
from django.test import TestCase | ||
from django.utils.translation import gettext as _ | ||
|
||
from zgw_consumers.api_models.base import factory | ||
|
||
from open_inwoner.openzaak.api_models import Zaak | ||
|
||
|
||
class ZaakAPIModelTest(TestCase): | ||
def setUp(self): | ||
self.zaak_data = { | ||
"url": "", | ||
"identificatie": "", | ||
"bronorganisatie": "", | ||
"omschrijving": "", | ||
"zaaktype": "", | ||
"registratiedatum": "2024-08-04", | ||
"startdatum": "2024-08-04", | ||
"vertrouwelijkheidaanduiding": "", | ||
"status": { | ||
"statustype": { | ||
"statustekst": "", | ||
"omschrijving": "", | ||
} | ||
}, | ||
"einddatum": None, | ||
"resultaat": { | ||
"resultaattype": { | ||
"naam": "", | ||
"omschrijving": "", | ||
"omschrijving_generiek": "", | ||
"resultaattypeomschrijving": "", | ||
}, | ||
}, | ||
} | ||
|
||
def test_status_text_no_result(self): | ||
zaak_statustype = self.zaak_data["status"]["statustype"] | ||
|
||
zaak_statustype["statustekst"] = "test statustekst" | ||
zaak_statustype["omschrijving"] = "test omschrijving" | ||
|
||
case = factory(Zaak, data=self.zaak_data) | ||
|
||
self.assertEqual(case.status_text, "test statustekst") | ||
|
||
case.status["statustype"]["statustekst"] = "" | ||
|
||
self.assertEqual(case.status_text, "test omschrijving") | ||
|
||
def test_status_text_with_result(self): | ||
self.zaak_data["status"]["statustype"]["statustekst"] = "test statustekst" | ||
self.zaak_data["einddatum"] = "2024-08-06" | ||
|
||
resultaattype = self.zaak_data["resultaat"]["resultaattype"] | ||
|
||
resultaattype["naam"] = "test naam" | ||
resultaattype["omschrijving"] = "test omschrijving" | ||
resultaattype["omschrijving_generiek"] = "test omschrijving_generiek" | ||
resultaattype["resultaattypeomschrijving"] = "test resultaattypeomschrijving" | ||
|
||
case = factory(Zaak, data=self.zaak_data) | ||
|
||
self.assertEqual(case.status_text, "test naam") | ||
|
||
case.resultaat["resultaattype"]["naam"] = "" | ||
|
||
self.assertEqual(case.status_text, "test omschrijving") | ||
|
||
case.resultaat["resultaattype"]["omschrijving"] = "" | ||
|
||
self.assertEqual(case.status_text, "test omschrijving_generiek") | ||
|
||
case.resultaat["resultaattype"]["omschrijving_generiek"] = "" | ||
|
||
self.assertEqual(case.status_text, "test resultaattypeomschrijving") | ||
|
||
def test_status_text_with_result_but_no_end_data(self): | ||
self.zaak_data["status"]["statustype"]["statustekst"] = "test statustekst" | ||
|
||
resultaattype = self.zaak_data["resultaat"]["resultaattype"] | ||
|
||
resultaattype["naam"] = "test naam" | ||
|
||
case = factory(Zaak, data=self.zaak_data) | ||
|
||
self.assertEqual(case.status_text, "test statustekst") | ||
|
||
def test_status_text_default(self): | ||
case = factory(Zaak, data=self.zaak_data) | ||
|
||
self.assertEqual(case.status_text, _("No data available")) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double checking: will this value also be translated in the submissions themselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translation in the template was indeed missing; I've added it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I didn't even think of that, but 👍 .
I actually meant this snippet:
I was concerned whether there is a situation where
SUBMISSION_STATUS_OPEN
is translated butstatsuses
is not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statuses are retrieved in
openzaak/api_models.py
and indeed not translated, since we don't have control over what statuses are returned. We can translate the "status" for open submissions since it is our own. Do you think it would be better to leave it untranslated as well for consistency?