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

[#1963] Sort documents in case detail view #913

Merged
merged 1 commit into from
Dec 27, 2023

Conversation

pi-sigma
Copy link
Contributor

Taiga #1963

@codecov-commenter
Copy link

codecov-commenter commented Dec 21, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (1d05ead) 92.93% compared to head (4e98931) 92.93%.
Report is 2 commits behind head on develop.

Files Patch % Lines
src/open_inwoner/cms/cases/tests/test_htmx.py 0.00% 3 Missing ⚠️
src/open_inwoner/cms/cases/views/status.py 71.42% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #913   +/-   ##
========================================
  Coverage    92.93%   92.93%           
========================================
  Files          819      819           
  Lines        28250    28280   +30     
========================================
+ Hits         26255    26283   +28     
- Misses        1995     1997    +2     

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

@pi-sigma pi-sigma force-pushed the fix/1963-document-list-order branch 2 times, most recently from 6a20af0 to 40071c3 Compare December 21, 2023 11:13
@pi-sigma
Copy link
Contributor Author

@alextreme I encountered failing tests which were missing the registratiedatum attribute that I use to sort the document list. This makes me wonder about the assumptions we are making w.r.t. information objects.

The schema for ZaakInformatieObject does not require a registratiedatum, but our corresponding dataclass in openzaak/api_models.py assumes that the requirement is satisfied. Similarly, the file creation in our case detail view sets the created attribute on the file based on the registratiedatum of the ZaakInformatieObject. Can we assume that instances of ZaakInformatieObject have a registratiedatum. If not, how do we want to handle the sorting?

@pi-sigma pi-sigma marked this pull request as ready for review December 21, 2023 11:30
@pi-sigma pi-sigma requested a review from alextreme December 21, 2023 11:30
@alextreme
Copy link
Member

@alextreme I encountered failing tests which were missing the registratiedatum attribute that I use to sort the document list. This makes me wonder about the assumptions we are making w.r.t. information objects.

The schema for ZaakInformatieObject does not require a registratiedatum, but our corresponding dataclass in openzaak/api_models.py assumes that the requirement is satisfied. Similarly, the file creation in our case detail view sets the created attribute on the file based on the registratiedatum of the ZaakInformatieObject. Can we assume that instances of ZaakInformatieObject have a registratiedatum. If not, how do we want to handle the sorting?

@pi-sigma registratiedatum is optional in the ZGW API spec, however both Open Zaak and the eSuite fill this in, I suspect that it's optional when creating a ZaakInformatieObject but is auto-populated when creating the relation.

So how I'd do this is sort on registratiedatum, otherwise sort on title and if both are empty use the order as returned from the API.

Copy link
Member

@alextreme alextreme left a comment

Choose a reason for hiding this comment

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

Consider fallback on title and ensure we have tests which show behaviour without registratiedatum

@pi-sigma pi-sigma force-pushed the fix/1963-document-list-order branch from 40071c3 to 4e98931 Compare December 21, 2023 16:06
@pi-sigma
Copy link
Contributor Author

@alextreme A creation date is indeed automatically inserted for documents without registratiedatum. Comparing them however is not straightforward because one is timezone-aware the other naive. I went with the solution you suggested, fallback on document title/name and unordered list, if necessary.

@alextreme
Copy link
Member

@pi-sigma Good solution, however please add a regressiontest verifying the original issue that the newest document should be the first one, I didn't see this from your changes (but may have overlooked it)

@alextreme alextreme merged commit 5ee33d8 into develop Dec 27, 2023
@alextreme alextreme deleted the fix/1963-document-list-order branch December 27, 2023 15:51
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.

3 participants