Open pdpinch opened 7 years ago
@Ferdi is this accurate to what we discussed this morning?
@aliceriot does this make sense?
It generally makes sense to me, but I'm not sure I agree with the plan overall. I don't see a great problem with doing validation on the frontend when we load the app - it is not an expensive operation or anything. We already have a system in place for identifying when the user has missing fields and prompting them to be filled in, I don't really see why we would spend time and effort to remove that feature from the frontend and move it to the backend.
BTW the redirect code currently checks both filled_out
and the validation, doing something like:
// this runs the full validation suite, returns a boolean
let [ complete ] = validationProfileComplete(profile);
if ( ! complete || ! profile.filled_out ) {
router.push(`/profile`) // do the redirect
}
Also, to hopefully clarify a little, filled_out
captures a different thing than that the validation passes - filled_out
could be false on a valid profile, because we do not set filled_out
to be true
until the user gets all the way through the profile flow. So they could fill out the first page, after which their profile would pass the validation, but filled_out
would still be false
.
Currently, we validate all the fields in the user profile whenever the MicroMasters app is loaded (e.g. /dashboard, /learner or /learners). This seems unnecessary, especially when we have a field
filled_out
which is supposed to be true when the user's profile is complete.For this to work, when we add new required fields to the profile model, we have to include a migration that sets
filled_out
to false for any user that doesn't have a value for the new required field.acceptance criteria
filled_out
instead of validating the entire profilemissing_fields
) perhaps that can be used to identify fields that need to be filled in for validation.