eiman-kased / starbulls

1 stars 4 forks source link

110 js form transition #120

Closed billythakidd04 closed 3 years ago

billythakidd04 commented 3 years ago

This should now work. If a user is unknown (not in the db) when they try to enter a review, the new user form should display.

In testing:

margeschrec commented 3 years ago

Ok, went to check this again this morning and I'm getting a 404 not found when I enter a new email. consolelog network response message "user not found", it does not change the form or save the review to the db.

billythakidd04 commented 3 years ago

Ok, went to check this again this morning and I'm getting a 404 not found when I enter a new email. consolelog network response message "user not found", it does not change the form or save the review to the db.

@margeschrec a 404 is expected on the first attempt. But you're saying it doesn't save the user or review at all? Which form isn't showing. I need more info. Can you lay out your steps and possibly some screen shots or something to better explain your issue?

margeschrec commented 3 years ago

Ok, went to check this again this morning and I'm getting a 404 not found when I enter a new email. consolelog network response message "user not found", it does not change the form or save the review to the db.

@margeschrec a 404 is expected on the first attempt. But you're saying it doesn't save the user or review at all? Which form isn't showing. I need more info. Can you lay out your steps and possibly some screen shots or something to better explain your issue?

image

So if I start a new review with a new email like here with 4@4.4, after I click submit I get the "please sign up to submit the review" alert window at the top of the page and the form does not change to the create new user form, it dose save what was written in the review form...

image

and its interesting because now I no longer get the 404 error in the console.

https://www.awesomescreenshot.com/video/3428119?key=4884d3bd1462a0b106f5e8f38b36d9f0

When I tested with an email already in the db it creates a new review as planned (without creating a new user with the same email- which is what we want).

vricci518 commented 3 years ago

Ran a test review using an existing user already in the database. The review does not get accepted, the form does not clear. When entering an email that does not exist in the database it does the same thing. Does not give alert window to create a new user account.

billythakidd04 commented 3 years ago

yea Im testing now... Then def worked when I pushed up my last set of changes :roll_eyes:

billythakidd04 commented 3 years ago

ok this should be fixed now. Since we also changed how we handle the errors for not found users (ie return a proper 404) the $.done() function doesn't handle the error. Switched to $.then(successCallback, failureCallback) and refactored the functions accordingly.

https://api.jquery.com/jquery.when/ https://api.jquery.com/deferred.then/#deferred-then-doneCallbacks-failCallbacks

billythakidd04 commented 3 years ago

@margeschrec I had not noticed until looking into #113 but the initial commit to this branch is removing all of the backend validation. That needs to be undone. If the user turns off js the php is our only protection and manner of submitting.

margeschrec commented 3 years ago

@margeschrec I had not noticed until looking into #113 but the initial commit to this branch is removing all of the backend validation. That needs to be undone. If the user turns off js the php is our only protection and manner of submitting.

Yes, big oversight on my part- fixing this now

billythakidd04 commented 3 years ago

We need a way to tell the user that their review was successfully submitted. Maybe hide the form and show a Thank You for your review message.

@eiman-kased this should be implemented. Please rereview.

eiman-kased commented 3 years ago

We need a way to tell the user that their review was successfully submitted. Maybe hide the form and show a Thank You for your review message.

@eiman-kased this should be implemented. Please rereview.

This works!

billythakidd04 commented 3 years ago

i approve rubber stamping this as we tested as a group