-
Notifications
You must be signed in to change notification settings - Fork 25
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
1776 validate show total validations #2029
Conversation
Changed the label from the amount of labels completed in the current mission to how labels completed in one stretch, by using svv.misisonsCompleted TODO: change svv.missionsCompleted to store the amount of missions the user has completed in all time
Queried the database for the total completed validations for each user, and got the data to be available in Mission.js
Changed the label in validate to show the total number of validations performed by the current user
Made the label count correct for the first time the validation page loads
Fixed a bug that would change the value of the labels completed during the mission end screen
@kumararoosh could you provide before/after screenshots? |
Looks like you're only including validations from completed missions. I don't see any reason to only take the ones from completed missions. May as well include all missions? This also means that since you are only using the completed mission count, you are assuming that all missions include 10 labels. That is true right now, but may not always be true in the future. |
Changed countCompletedValidationMissionsByUserID in MisstionTable.scala to count all of the validated labels instead of counting all of the validated missions.
Edited all of the files responsible for displaying the amount of validations performed by the user, to instead use the total number of labels validated instead of total number of validation missions completed.
The number of labels validated is now the total number of labels the user has validated |
…Webpage into 1776-validate-show-total-validations
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.
Nice work on fixing up the backend! It looks really nice and clean and works well now! Just looking for some cleaning up of the frontend portion now :)
if (labelsProgress < getProperty("labelsValidated")) { | ||
if (!skip) { | ||
labelsProgress += 1; | ||
} | ||
svv.statusField.updateLabelCounts(labelsProgress); | ||
var missionLabelNumber = labelsProgress + svv.validationsCompleted; |
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.
This seems like kind of a messy way to keep track of the number of completed validations. What if instead of recomputing it every time, the statusField object just kept track of the count, and then when a label is validated, a function is called that increments that count?
@@ -83,12 +85,19 @@ function Mission(params) { | |||
* progress will increase. | |||
*/ | |||
function updateMissionProgress(skip) { | |||
// console.log(getProperties()); |
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.
Can you remove this comment?
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.
Do you want me to uncomment it, or just delete the line?
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.
Just delete the line
The label is updated by taking the number being displayed to the user and incrementing the number. Added a helper function in StatusField to help with the incrementing.
….com/ProjectSidewalk/SidewalkWebpage into 1776-validate-show-total-validations
I believe everything has been cleaned up now |
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 think you may have missed a couple places where you added code for counting completed missions that you don't need.
* Increments the number of labels the user has validated by 1 | ||
*/ | ||
function incrementLabelCounts(){ | ||
updateLabelCounts(parseInt(svv.ui.status.labelCount.html()) + 1); |
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 think it would be better for this file to have a variable that saves the current validation count instead of looking at the HTML to find it. Then updateLabelCounts
can update that variable.
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'm now using the existing svv.validationsCompleted variable to store the total number of validations completed
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.
Actually, I think it is best to just never have that global variable. You can pass in param.completedValidations
to the StatusField
constructor and save the variable locally in the StatusField
object.
Since the total completed validations is stored in svv.validationsCompleted when loaded from the database, the labels now just displays the value of svv.validationsCompleted and increments the variable each time a validation is made.
Made requested changes |
svv.missionsCompleted = param.missionSetProgress; | ||
svv.validationsCompleted = param.completedValidations; |
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.
Instead of saving this in a global variable (svv.validationsCompleted
) you should pass in param.completedValidations to the StatusField constructor and save the variable locally in the StatusField object.
Started storing the value of total completed validations in StatusField by passing it in as a parameter, and changed updating to requiring the increment and refresh methods be called in StatusField
I am now passing the total validations to statusField and requiring everything else to call the new incrementLabelCounts and refreshLabelCountsDisplay methods inside of statusField in order to manipulate the statusField. Should we then update the javaDoc for statusField on how it should manipulate the displayed value? |
I guess so? Not exactly sure what you're envisioning. The setup seems pretty simple and you've added comments for the methods, so not sure what else you're proposing we add |
Removed updateLabelCount and every use of the function. The new process for updating the labels is to send the value to statusField as a parameter and call refreshLabelCountsDisplay() or incrementLabelCounts()
This branch should be completed now |
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.
Again, just some super nitpicky comment style stuff. You'll get used to our code style soon! Then just make sure to triple check before asking for reviews to make sure everything looks nice :)
…Webpage into 1776-validate-show-total-validations
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.
Great, thanks @kumararoosh !
resolves #1776 by querying the database for all completed validation missions by the current user and adding the amount of labels validated in those missions to the displayed label count.