-
Notifications
You must be signed in to change notification settings - Fork 35
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
update bundling workflow and add task locking for bundles #2524
base: main
Are you sure you want to change the base?
update bundling workflow and add task locking for bundles #2524
Conversation
6f6d47b
to
b3258b1
Compare
58baf90
to
8a9a1fe
Compare
c6d541a
to
544e31c
Compare
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.
LGTM
const showAsClusters = | ||
((this.props.criteria?.zoom ?? 0) < MAX_ZOOM && | ||
(wantToShowAsClusters || this.state.taskCount > UNCLUSTER_THRESHOLD) && | ||
!this.props.createTaskBundle && | ||
this.state.taskCount > UNCLUSTER_THRESHOLD) || | ||
!this.props.createTaskBundle) || | ||
!this.props.criteria.boundingBox; |
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 see there was a bug in this logic that you fixed already. FWIW I like to write complex conditionals like this in pieces, like this, which IMO helps with readability.
const isAtMaxZoom = (this.props.criteria?.zoom ?? 0) >= MAX_ZOOM;
const tooManyTasksToShowUnclustered = this.state.taskCount > UNCLUSTER_THRESHOLD;
const showAsClusters = !isAtMaxZoom && (wantToShowAsClusters || tooManyTasksToShowUnclustered) && !this.props.createTaskBundle;
Another trick is to move the logic into a helper function where you can use the early return pattern.
function showAsClusters() {
if ((this.props.criteria?.zoom ?? 0) >= MAX_ZOOM) {
return false; // don't cluster at max zoom
}
if (this.props.createTaskBundle) {
return false; // don't cluster when the user is creating a task bundle
}
if (this.state.taskCount > UNCLUSTER_THRESHOLD) {
return true; // always cluster if there are tons of tasks visible
}
// otherwise respect the user's preference for whether or not to cluster
return wantsToShowAsClusters;
}
The latter is more verbose, but that actually has a hidden benefit: combinations of conditions that aren't tested will show up in code coverage results (whereas a single big conditional expression will always be hit, so you may not realize that your tests don't exercise every possible combination).
Simplified rebase of #2500
partially resolves: #2540
potentially resolves: #1495
Issue
Bundles are not being reset or deleted when a user remains inactive for an extended period, allowing them to bypass the bundle reset conditions. This leads to various issues, such as finalized conditions in the completion step not being properly set.
Solution
Instead of updating bundles in the database every time they are created or edited, they will now only be modified when a user completes a task. The task lock status will prevent other users from bundling tasks that have already been bundled by another user.
New Functionality