Fix priority rules and bounds updates#1233
Merged
Merged
Conversation
…ment, improving performance and safety by utilizing parameter binding for user-supplied values. Removed outdated methods for priority calculation based on rules and bounds.
…g and state management. Added support for tracking recompute errors and improved UI feedback during priority updates.
- Updated the `recomputePriorities` method to return the count of rows whose priority actually changed, improving clarity on task updates. - Enhanced error handling by introducing `InvalidException` for untranslatable rules, ensuring better feedback on priority computation failures. - Removed outdated comments and streamlined the logic for counting task priority changes, aligning with the new return structure. - Adjusted the `updateTaskPriorities` method to reflect the changes in priority computation, providing a clearer response for clients.
jake-low
previously approved these changes
Jun 5, 2026
jake-low
left a comment
Contributor
There was a problem hiding this comment.
This looks like a nice improvement. I left a couple suggestions but overall this LGTM. If it's a hassle to make changes and retest this then I'm okay merging as-is.
…f task count tuples, now returning `Unit` instead. - Updated the `ChallengeController` to reflect changes in the priority update process, focusing on the post-recompute priority distribution. - Enhanced comments for clarity regarding the priority distribution and the implications of zero counts. - Streamlined the SQL logic in `recomputePriorities` to improve efficiency and maintainability.
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Replaces the batched, per-task Scala recompute in
updateTaskPrioritieswith asingle SQL
UPDATE … SET priority = CASE … ENDissued against the wholechallenge. Priority rules and bounds are translated to SQL once
(
buildPriorityCaseExpression) and the same expression is reused bypreviewTaskPriorities, so the editor preview is byte-for-byte identical towhat a save will write. (Preview is used for mr4)
UPDATE tasks WHERE id IN (…)per batchcollapse into one statement, executed in one transaction.
WHERE priority IS DISTINCT FROM (…)skips no-op rows;RETURNING priorityGROUP BYgives the(high, medium, low)tally of rows actually changed.ST_Intersects(geom, ST_GeomFromGeoJSON(…)).EXISTS (… jsonb_array_elements(features) … jsonb_each_text(properties) …)with case-insensitive key match (mirrors the old Scala
equalsIgnoreCase) and case-sensitive value match.contains/not_contains) →location && ST_MakeEnvelope(…, 4326).Should resolve maproulette/maproulette3#2800