Skip to content
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

fix(classifier): advance subjects immediately on Done #6699

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eatyourgreens
Copy link
Contributor

@eatyourgreens eatyourgreens commented Feb 17, 2025

Pass a doneAndTalk flag to completeClassification when Done or Done & Talk is clicked. Advance the subject queue immediately if it's false, otherwise wait until the classification is saved before advancing the subject and going to Talk.

Please request review from @zooniverse/frontend team or an individual member of that team.

Package

  • lib-classifier

Linked Issue and/or Talk Post

How to Review

You can test this out by classifying on Daily Minor Planet:
https://localhost:8080/?project=fulsdavid/the-daily-minor-planet&env=production

After pressing Done, the next subject will load while your classification saves in the background (like PFE.)

After pressing Done & Talk, your classification is saved before the page unloads and goes to Talk.

Checklist

PR Creator - Please cater the checklist to fit the review needed for your code changes.
PR Reviewer - Use the checklist during your review. Each point should be checkmarked or discussed before PR approval.

General

  • Tests are passing locally and on Github
  • Documentation is up to date and changelog has been updated if appropriate
  • You can yarn panic && yarn bootstrap or docker-compose up --build and FEM works as expected
  • FEM works in all major desktop browsers: Firefox, Chrome, Edge, Safari (Use Browserstack account as needed)
  • FEM works in a mobile browser

General UX

Example Staging Project: i-fancy-cats

  • All pages of a FEM project load: Home Page, Classify Page, and About Pages
  • Can submit a classification
  • Can sign-in and sign-out
  • The component is accessible

Bug Fix

  • The PR creator has listed user actions to use when testing if bug is fixed
  • The bug is fixed
  • Unit tests are added or updated

@coveralls
Copy link

coveralls commented Feb 17, 2025

Coverage Status

coverage: 75.548% (+0.004%) from 75.544%
when pulling ec08934 on eatyourgreens:subject-advance
into 415dc1c on zooniverse:master.

Comment on lines 177 to 189
if (!doneAndTalk) {
// advance to the next subject immediately.
self.loadingState = asyncStates.posting
yield self.classificationQueue.add(classification)
} else {
// advance to the next subject once the classification has been submitted.
yield self.classificationQueue.add(classification)
self.loadingState = asyncStates.posting
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch works because the classifier's root store advances the subject queue when the classification loading state changes to 'posting' (which isn't immediately obvious, to be honest.)

function _onPatch(patch) {
// TODO: why are we doing this rather than observe classifications.loadingState for changes?
const { path, value } = patch
if (path === '/classifications/loadingState' && value === 'posting') {
self.subjects.advance()
}
}

@eatyourgreens eatyourgreens changed the title fix(classifier): advance subjects on Done fix(classifier): advance subjects immediately on Done Feb 17, 2025
@eatyourgreens eatyourgreens force-pushed the subject-advance branch 2 times, most recently from a81306d to 3916eee Compare February 18, 2025 16:12
@mcbouslog mcbouslog self-requested a review February 18, 2025 17:29
@mcbouslog mcbouslog assigned mcbouslog and unassigned mcbouslog Feb 18, 2025
Pass a `doneAndTalk` flag to `completeClassification` when Done & Talk is clicked. Advance the subject queue immediately if it's false, otherwise wait until the classification is saved before advancing the subject and going to Talk.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Classifier: Long delays (up to 10s) after pressing Done
3 participants