-
Notifications
You must be signed in to change notification settings - Fork 1
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
Combined functionality to schedule and complete ad-hoc observation into one endpoint #2697
base: main
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@@ -408,38 +412,56 @@ class ObservationService( | |||
} | |||
|
|||
/** | |||
* Schedule an ad-hoc observation. This creates an ad-hoc observation, creates an ad-hoc | |||
* monitoring plot, and adds the plot to the observation. | |||
* Record an ad-hoc observation. This creates an ad-hoc observation, creates an ad-hoc monitoring |
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.
Nit: KDoc convention, which was inherited from Javadoc, is to use singular present tense. So this would be "Records" instead of "Record" (and "completes" instead of "complete" on the next line).
observationType: ObservationType, | ||
plantingSiteId: PlantingSiteId, | ||
plants: Collection<RecordedPlantsRow>, | ||
plotName: String, |
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.
Just noting that plot names are going away shortly, so we shouldn't build new client code that expects to be able to pass in a user-supplied name. (But removing this parameter isn't appropriate yet since names still exist for now.)
swCorner: Point, | ||
): Pair<ObservationId, MonitoringPlotId> { | ||
requirePermissions { scheduleAdHocObservation(plantingSiteId) } | ||
|
||
validateSchedule(plantingSiteId, startDate, endDate) | ||
if (observedTime.isAfter(clock.instant())) { |
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.
It's good to reject wildly wrong timestamps, but I'm concerned this check will be sensitive to clock skew and will reject legitimate observations where the user's phone clock is ahead of the server's clock by a small amount.
* Validation rules: 1a. for non-ad-hoc, start date can be up to one year from today and not | ||
* earlier than today. 1b. for ad-hoc, start date can be on or before today. | ||
* 2. end date should be after the start date but no more than 2 months from the start date. |
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.
I think the "1a" and "1b" are confusing the formatter because they're not valid Markdown list item numbers.
plantCountsBySpecies, | ||
) | ||
} | ||
|
||
updateSpeciesTotalsTable( |
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.
Verifying the intent here: we want to update the site-level species totals based on ad-hoc observations?
No description provided.