Skip to content

Conversation

daniel-wer
Copy link
Member

@daniel-wer daniel-wer commented Nov 19, 2018

This PR allows to add a recommended configuration to task types. The recommended config is shown to users when they start to trace a task and their configuration differs from the recommended one. Users can then accept or decline this config which automatically applies it (or not).

The message will not trigger twice if the "Finish and get next task" functionality is used and the user changes settings in the mean time. It will also not trigger if a tracing is continued. However, if the user returns to the dashboard and starts the next task from there, the message will trigger again, although the task type did not change.
The requirement (from discuss) was:

These settings would then be set whenever a hiwi get a new task type.
again, only once when the task type changes.

but I'm not sure how to achieve that. We would need to persist the last task type for that.
With the current implementation, I'm afraid users might get annoyed with the configuration recommendations. What do you think?

URL of deployed dev instance (used for testing):

Steps to test:

  • Create a new task type. Select to "Add Recommended User Settings" and play around with the values, json in the textarea. You should not be able to create the task type with an invalid configuration.

  • Once you created a task type with a recommended config, click "Edit" in the task type list. The recommended config field should be checked and expanded.

  • During task type creation, if the recommended config contains errors and you uncheck that you want to add a recommended config, you should still be able to create the task type.

  • Create a task with a task type with/without a recommended config and get this task as a user.

  • Open the task to trace. You should see a message informing you about the recommended settings that can be applied or not.

  • Once you started tracing and reload the page, the message should no longer appear.

Issues:


@daniel-wer daniel-wer self-assigned this Nov 19, 2018
*
* @example
* api.user.setConfiguration("segmentationOpacity", 20);
* api.data.setConfiguration("segmentationOpacity", 20);
Copy link
Member Author

Choose a reason for hiding this comment

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

Some of these were messed up, probably because of copy paste errors :)

Copy link
Member

@philippotto philippotto left a comment

Choose a reason for hiding this comment

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

Nice implementation and refactoring 👍 Code per se looks good. I'll test it in a bit.

if (unmountResult && div.parentNode) {
div.parentNode.removeChild(div);
// The returned promise gets resolved once the element is destroyed.
export default function renderIndependently(
Copy link
Member

Choose a reason for hiding this comment

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

Nice 👍

@philippotto
Copy link
Member

Ok, I just tested the feature and it worked fine except for a few bits:

  • when editing an existing task type, checking the checkbox for recommended settings yielded in an empty settings field (I tried it for the default task type and was wondering what I should type in)
  • when using the "finish and get next task", I noticed two things:
    • switching to the next task without changing task type or dataset, the modal still appeared (even though you wrote "The message will not trigger twice if the "Finish and get next task" functionality is used").
    • in addition, in the above scenario the modal appeared twice in a row even if I did not change the accepted settings. I stepped through the code a bit and found that the keyboard delay (which should be set to 0) seemed to differ in the store? However, the settings should the correct value 🤔 Very strange. You should be able to reproduce it by creating two equal tasks and using finish-and-get-next-task (click accept and don't change settings).

The message will not trigger twice if the "Finish and get next task" functionality is used and the user changes settings in the mean time.

Where is this modelled in the code? I couldn't find the logic for that. I'm only seeing that on each wk_ready event, you are comparing the recommended settings with the actual ones? Wouldn't it make sense to reuse the "did task type change?" logic? If you are not changing the task type, the modal should probably never appear?

@daniel-wer
Copy link
Member Author

@philippotto Thanks for the thorough testing!

  • When editing an existing task type without recommended settings, the default settings are now shown when checking the checkbox. I've also added all setting possibilities to the right of the textarea.
  • Using "Finish and Get Next Task" should no longer re-trigger the recommended settings modal.
  • The keyboardDelay bug was triggered because mistakenly the datasetConfiguration contained a keyboardDelay value as well (probably some legacy property), although it belongs into the userConfiguration. We've already fixed this in the DB on master. You can fix it locally by running this script in pgadmin: update webknossos.user_datasetconfigurations set configuration = configuration - 'keyboardDelay'.

It would be really cool if you could do another round of testing :)

@daniel-wer
Copy link
Member Author

@rschwanhold In order to make this feature even more useful we want to persist the lastTaskTypeId for each user. lastTaskTypeId should be an optional field for each user (so it doesn't need to be included when creating or updating the user). In order to make it foolproof to update the lastTaskTypeId, it would be cool if you could add a PATCH route (or probably better make the /api/users/<userId> route accept PATCH requests), meaning we could send a request that only contains the userId and lastTaskTypeId (or whatever other user properties) and only those properties are updated :)

@rschwanhold
Copy link
Contributor

@daniel-wer I have added the lastTaskTypeId and changed the update-method of the User to support JSON-files with only a few values.
The route is still labeled as PUT instead of PATCH because I didn't want to update the corresponding frontend code, but feel free to do it yourself.

isSuperUser = false,
isDeactivated = !isActive
isDeactivated = !isActive,
lastTaskTypeId = None
Copy link
Contributor

Choose a reason for hiding this comment

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

@fm3 why do I need to specify lastTaskTypeId here but not in InitialDataController ?

Copy link
Member

Choose a reason for hiding this comment

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

Do you get compiler errors if you don’t? I don’t see why it would be a problem to omit it.

Copy link
Member

Choose a reason for hiding this comment

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

taking that back, I got the error also for InitialDataController. I suppose this has something to do with the other named parameters

@daniel-wer
Copy link
Member Author

@rschwanhold or @fm3 Seems to work very well, except that when getting the user, the lastTaskTypeId is an object with an id property instead of just the id as a string: lastTaskTypeId: {id: "5be99ac0930100d330dfef94"}. Could you change this, so it is just the string?

@rschwanhold
Copy link
Contributor

@daniel-wer you said that lastTaskTypeId should be optional. Is there a use case to set the field to NULL (in the DB) after this field contained an actual taskTypeId? Because I think right now this is not supported. How would you intend to set the value to NULL when you call the update-method?

@daniel-wer
Copy link
Member Author

@rschwanhold I don't think we'll ever need to set the lastTaskTypeId back to null after it contained a valid value. With "optional" I meant that it does not need to be included when updating the user. So all good :)

Do you know why the schema comparison fails on CircleCI?

@daniel-wer
Copy link
Member Author

  • When editing an existing task type without recommended settings, the default settings are now shown when checking the checkbox. I've also added all setting possibilities to the right of the textarea.
  • Using "Finish and Get Next Task" should no longer re-trigger the recommended settings modal.
  • The keyboardDelay bug was triggered because mistakenly the datasetConfiguration contained a keyboardDelay value as well (probably some legacy property), although it belongs into the userConfiguration. We've already fixed this in the DB on master. You can fix it locally by running this script in pgadmin: update webknossos.user_datasetconfigurations set configuration = configuration - 'keyboardDelay'.

@philippotto In addition to these changes, the lastTaskTypeId of a user is now persisted as well, which allows to really only show the "Task-Type Description" and "Recommended Configuration" Modals if the user traces a different task type than before :)

It would be great if you could have a final look and retest the things that failed for you last time :)

Copy link
Member

@philippotto philippotto left a comment

Choose a reason for hiding this comment

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

It would be great if you could have a final look and retest the things that failed for you last time :)

Works for me 👍 :)

@daniel-wer
Copy link
Member Author

daniel-wer commented Nov 27, 2018

@rschwanhold nevermind, I fixed the schema stuff, now scalafmt complains, though. Would be cool if you could fix that :)

@fm3 fm3 merged commit 0f19dbb into master Nov 29, 2018
@fm3 fm3 deleted the recommended-settings branch November 29, 2018 09:16
daniel-wer added a commit that referenced this pull request Nov 29, 2018
daniel-wer added a commit that referenced this pull request Nov 29, 2018
daniel-wer added a commit that referenced this pull request Nov 29, 2018
daniel-wer added a commit that referenced this pull request Dec 5, 2018
* Revert "Revert "Add Recommended Configuration to Task Types (#3466)" (#3502)"

This reverts commit 246fbae.

* add route to change the lasttasktypeid

* use new taskTypeId route to update user's lastTaskTypeId

* add display names and comments to recommended settings

* add buttons to remove some of the recommended configuration quickly

* uppercase button caption
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to specify recommended user settings via task type
4 participants