Conversation
git-voo
left a comment
There was a problem hiding this comment.
This is great, the server receives single and multiple updates as we want. I'd request a change in the alerts to make sure it shows what was updated instead of just "threshold..." at all times. If you are unable to setup personalized alert for this you can use a generic one for the scope of this PR
| const [sendMAF, setSendMAF] = useState(false); | ||
|
|
||
| function activateToast() { | ||
| threshold_toast.current.show({ severity: "success", summary: "Submitted", detail: "Threshold successfully submitted!" }); |
There was a problem hiding this comment.
This will always alert "Threshold successfully submitted!" for all all updates including ONLY MA updates and MA with Threshold update
There was a problem hiding this comment.
@Jaywin2099 You can merge this in as soon as you adjust the alert
There was a problem hiding this comment.
@git-voo sounds good. The toast now notifies the user of whatever variable was changed, and it warns the user if none were. Merging is still blocked for me, pending your code review.
Fixes #109
What was changed:
Right now, only the threshold is sent to the backend when the submit button is presssed in the ResearcherToolbar component. This PR adds support for the movingAverageFactor variable as well. Tests to verify the correct functionality of this feature were added as well.

Why was this changed:
In order for the researcher to change the MAF and threshold parameters.
How was it changed:
Adding support for MAF into the sendThreshold function required changing the format from expecting only the threshold to any object.
In order to reduce redundancy and websocket payloads, flags were set to watch for threshold and MAF updates, so that when the submit button is pressed, only updated parameters would be sent to the backend. This was done by creating an empty object and adding whichever variables were flagged as changed from the previous button press.
A few tests were added to make sure only the updated variables were added to the payload, and the existing test, which verified the correct values sent, were expanded to test MAF in addition to threshold values.