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

refactor(classifier): make task.required a boolean #6094

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eatyourgreens
Copy link
Contributor

@eatyourgreens eatyourgreens commented May 15, 2024

Remove types.string from task.required. Fixes a small bug where a task with required: 'false' would be required. String values are now coerced to booleans in a snapshot preprocessor.

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

Package

  • lib-classifier/plugins/tasks

Linked Issue and/or Talk Post

How to Review

This shouldn't change any live projects. The project builder nowadays should be saving task.required as a boolean, so the string type was only needed for very old workflows. You could deliberately create a workflow task with required: 'false', with an API client, but I've added tests to verify that legacy string values are handled correctly now.

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

Refactoring

  • The PR creator has described the reason for refactoring
  • The refactored component(s) continue to work as expected

@coveralls
Copy link

coveralls commented May 15, 2024

Coverage Status

coverage: 79.302% (-0.02%) from 79.323%
when pulling 0b28270 on eatyourgreens:refactor-task-required
into 9a7a630 on zooniverse:master.

@@ -6,10 +6,22 @@ const Task = types.model('Task', {
// override annotation in individual task models with specific annotation types
annotation: types.safeReference(Annotation),
taskKey: types.identifier,
required: types.maybe(types.union(types.string, types.boolean)), // text task required default = false
required: types.optional(types.boolean, false), // text task required default = false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does anyone remember what the comment means here?

@eatyourgreens eatyourgreens force-pushed the refactor-task-required branch 7 times, most recently from be8797c to fca9cc2 Compare May 20, 2024 20:46
Remove `types.string` from `task.required`. Fixes a small bug where a task with `required: 'false'` would be required. String values are now coerced to booleans in a snapshot preprocessor.
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.

None yet

2 participants