-
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
Do a much more thorough job with item times #728
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d149049
insert datetimes / time ranges with item inserts
jisantuc 8efa09f
factor out time access and update in updates
jisantuc c4ee901
update tests for always having an item datetime
jisantuc 162a07b
simplify filter generation a little more
jisantuc 8fc7329
correct time filtering behavior to respect ranges
jisantuc 6a95ecb
do a much more thorough job testing time range filters
jisantuc ea61c59
bump to stac4s version supporting time improvements
jisantuc 37fb1ae
test all properties update now that that's more interesting
jisantuc 35fdd40
add migration to fix existing items
jisantuc 77a7fc6
lint
jisantuc 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
16 changes: 16 additions & 0 deletions
16
application/src/main/resources/migrations/V12__update_time_fields_again.sql
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,16 @@ | ||
UPDATE | ||
collection_items | ||
SET | ||
datetime = (item -> 'properties' ->> 'datetime') :: timestamp with time zone | ||
WHERE | ||
item -> 'properties' ? 'datetime' | ||
AND datetime is null; | ||
|
||
UPDATE | ||
collection_items | ||
SET | ||
start_datetime = (item -> 'properties' ->> 'start_datetime') :: timestamp with time zone, | ||
end_datetime = (item -> 'properties' ->> 'end_datetime') :: timestamp with time zone | ||
WHERE | ||
item -> 'properties' ? 'start_datetime' | ||
AND start_datetime is null; |
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 |
---|---|---|
|
@@ -18,11 +18,13 @@ trait FilterHelpers { | |
def toFilterFragment: Option[Fragment] = { | ||
temporalExtent.value match { | ||
case Some(start) :: Some(end) :: _ => | ||
Some(fr"(datetime >= $start AND datetime <= $end)") | ||
Some( | ||
fr"(datetime >= $start AND datetime <= $end) OR (start_datetime >= $start AND end_datetime <= $end)" | ||
) | ||
case Some(start) :: _ => | ||
Some(fr"datetime >= $start") | ||
Some(fr"(datetime >= $start OR start_datetime >= $start)") | ||
case _ :: Some(end) :: _ => | ||
Some(fr"datetime <= $end") | ||
Some(fr"(datetime <= $end OR end_datetime <= $end)") | ||
Comment on lines
+21
to
+27
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. Nice catch! |
||
case _ => None | ||
} | ||
} | ||
|
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
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.
Ouf, I also don't know how to handle it better.
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.
Yeah I spent about four seconds adding an
Encoder.AsObject
instac4s
but decided not to -- it's not hard but it didn't seem important enough