Skip to content

Feature #41 | Fix - physical sample draft fields get lost after saving - #131

Open
gabrielakuhn wants to merge 2 commits into
feat-41/igsnfrom
wip-feat-41-igsn-fix-draft
Open

Feature #41 | Fix - physical sample draft fields get lost after saving#131
gabrielakuhn wants to merge 2 commits into
feat-41/igsnfrom
wip-feat-41-igsn-fix-draft

Conversation

@gabrielakuhn

Copy link
Copy Markdown
Collaborator

Summary

When save a physical sample as a draft or submitting it to review, some fields get lost after saving because of 2 reasons: cache was not invalidating the correct and some data were not persistent.

Changes

web: Fix physical sample draft fields lost after saving

  • src/djehuty/web/database.py: Correct cache prefixes invalidated on
    physical sample update, remove a redundant second run of the update and
    persist the deposit and publish agreement on update.
  • src/djehuty/web/wsgi.py: Persist the alternate identifier and the deposit
    and publish agreement when saving a physical sample draft.
  • src/djehuty/web/resources/sparql_templates/update_physical_sample_draft.sparql:
    Update the deposit and publish agreement triples.
  • src/djehuty/web/resources/sparql_templates/physical-samples.sparql: Return
    the deposit and publish agreement of a physical sample.
  • src/djehuty/web/resources/static/js/edit-physical-sample.js: Send the
    deposit and publish agreement when saving a draft.
  • src/djehuty/web/resources/html_templates/depositor/edit-physical-sample.html:
    Show the agreement checkboxes pre-filled from the saved draft and keep
    them visible but read-only when it is under review.

Approval Checklist

  • I agree to follow Djehuty's code of conduct.
  • I have read and I have follow the code contribution workflow.
  • Code style and conventions were respected.
  • Documentation has been updated where needed (README, docs, or examples).
  • Review approved by at least one maintainer.
  • Merge readiness (PR is squashed into a single commit and follows the commit template).

**Issue Reference **

Part of #41

Notes

Branch forked from wip-feat-41-igsn-issued-date

@gabrielakuhn gabrielakuhn changed the title Wip feat 41 igsn fix draft Feature #42 | Fix - physical sample draft fields get lost after saving Jun 26, 2026
@gabrielakuhn gabrielakuhn changed the title Feature #42 | Fix - physical sample draft fields get lost after saving Feature #41 | Fix - physical sample draft fields get lost after saving Jun 30, 2026
@gabrielakuhn
gabrielakuhn force-pushed the wip-feat-41-igsn-fix-draft branch from 43649d2 to 1cc3472 Compare June 30, 2026 11:50
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.33%. Comparing base (b682cd4) to head (9803a48).

Additional details and impacted files
@@              Coverage Diff              @@
##           feat-41/igsn     #131   +/-   ##
=============================================
  Coverage         16.33%   16.33%           
=============================================
  Files                21       21           
  Lines             11447    11447           
  Branches           2246     2246           
=============================================
  Hits               1870     1870           
  Misses             9386     9386           
  Partials            191      191           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gabrielakuhn
gabrielakuhn requested review from kairoaraujo and removed request for kairoaraujo July 2, 2026 14:54
@gabrielakuhn
gabrielakuhn force-pushed the wip-feat-41-igsn-fix-draft branch from 1cc3472 to 02c021f Compare July 3, 2026 09:42
@gabrielakuhn
gabrielakuhn marked this pull request as ready for review July 3, 2026 09:42
@gabrielakuhn
gabrielakuhn force-pushed the wip-feat-41-igsn-fix-draft branch from 02c021f to 664f754 Compare July 6, 2026 15:06

@kairoaraujo kairoaraujo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Check if caught it correct, please.

Comment thread src/djehuty/web/wsgi.py
"sample_owner_name": validator.string_value (record, "sample_owner_name", 0, 255, False),
"sample_owner_email": validator.string_value (record, "sample_owner_email", 0, 255, False),
"group_id": validator.integer_value (record, "group_id", 0, pow(2, 63), False),
"agreed_to_deposit_agreement": validator.boolean_value (record, "agreed_to_deposit_agreement", False, False),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this makes the agreements writable on draft-save but it doesn't check the review state, and the template already disables these checkboxes under review. So an API caller can still flip the agreements back to false on an under-review sample. We could skip just these two params when its under review so the backend matches the UI?

Base automatically changed from wip-feat-41-igsn-issued-date to feat-41/igsn July 31, 2026 16:06
* src/djehuty/web/database.py: Fix cache prefixes invalidated on
  physical sample update and remove a redundant second run of the update.
* src/djehuty/web/wsgi.py: Persist the alternate identifier when saving a
  physical sample draft.
* src/djehuty/web/wsgi.py: Save the deposit and publish agreement when
  saving a physical sample draft and when submitting it for review.
* src/djehuty/web/database.py: Accept and store the deposit and publish
  agreement on physical sample update.
* src/djehuty/web/resources/sparql_templates/update_physical_sample_draft.sparql:
  Update the deposit and publish agreement triples.
* src/djehuty/web/resources/sparql_templates/physical-samples.sparql: Return
  the deposit and publish agreement of a physical sample.
* src/djehuty/web/resources/static/js/edit-physical-sample.js: Send the
  deposit and publish agreement when saving a draft.
* src/djehuty/web/resources/html_templates/depositor/edit-physical-sample.html:
  Pre-fill the agreement checkboxes from the saved draft and keep them
  visible but read-only while under review.
@gabrielakuhn
gabrielakuhn force-pushed the wip-feat-41-igsn-fix-draft branch from 664f754 to 9803a48 Compare July 31, 2026 16:09
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.

2 participants