-
Notifications
You must be signed in to change notification settings - Fork 19
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
added last_update column to ag_kit_barcodes #558
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
38293d4
added last_update
ayobi 6e3c80e
modified tests
ayobi cbdc382
improvements
ayobi 637a851
lint
ayobi b82a757
updated latest_sample_information_update to now()
ayobi b4d1a6c
Merge branch 'biocore:master' into master
ayobi 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Jan 26, 2024 | ||
-- Add sample metadata update timestamp | ||
ALTER TABLE ag.ag_kit_barcodes | ||
ADD COLUMN last_update timestamp with time zone; | ||
|
||
COMMENT ON COLUMN ag.ag_kit_barcodes.last_update | ||
IS 'Sample metadata update timestamp'; | ||
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
class Sample(ModelBase): | ||
def __init__(self, sample_id, datetime_collected, site, notes, barcode, | ||
latest_scan_timestamp, source_id, account_id, | ||
latest_scan_timestamp, source_id, account_id, last_update, | ||
sample_projects, latest_scan_status, kit_id=None): | ||
self.id = sample_id | ||
# NB: datetime_collected may be None if sample not yet used | ||
|
@@ -17,6 +17,7 @@ def __init__(self, sample_id, datetime_collected, site, notes, barcode, | |
# NB: _latest_scan_timestamp may be None if not yet returned to lab | ||
self._latest_scan_timestamp = latest_scan_timestamp | ||
self._latest_scan_status = latest_scan_status | ||
self.last_update = last_update | ||
self.sample_projects = sample_projects | ||
|
||
self.source_id = source_id | ||
|
@@ -42,7 +43,7 @@ def remove_locked(self): | |
|
||
@classmethod | ||
def from_db(cls, sample_id, date_collected, time_collected, | ||
site, notes, barcode, latest_scan_timestamp, | ||
site, notes, barcode, latest_scan_timestamp, last_update, | ||
source_id, account_id, sample_projects, latest_scan_status): | ||
datetime_collected = None | ||
# NB a sample may NOT have date and time collected if it has been sent | ||
|
@@ -51,7 +52,7 @@ def from_db(cls, sample_id, date_collected, time_collected, | |
datetime_collected = datetime.combine(date_collected, | ||
time_collected) | ||
return cls(sample_id, datetime_collected, site, notes, barcode, | ||
latest_scan_timestamp, source_id, | ||
latest_scan_timestamp, last_update, source_id, | ||
account_id, sample_projects, latest_scan_status) | ||
|
||
def to_api(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
@@ -62,7 +63,9 @@ def to_api(self): | |
"sample_edit_locked": self.edit_locked, | ||
"sample_remove_locked": self.remove_locked, | ||
"sample_datetime": self.datetime_collected, | ||
"sample_latest_scan_timestamp": self._latest_scan_timestamp, | ||
"sample_notes": self.notes, | ||
"sample_last_update": self.last_update, | ||
"source_id": self.source_id, | ||
"account_id": self.account_id, | ||
"sample_projects": list(self.sample_projects), | ||
|
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
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.
As a field name,
last_update
is ambiguous. Can the field reflect the type of update it corresponds too?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.
Let's change this field name to
latest_sample_information_update
to clearly state that it's only tracking the info that belongs directly to a sample (e.g. collection date/time and type) and is ignoring other associations like metadata.Also, we do not need to null the column when a sample is deleted, but it would be beneficial to add a comment to the sample deletion code noting this decision and suggesting it be revisited if we ever use the new column for anything other than its current purpose of UI enhancement.