Fixing problem with saving birthday #274

Merged
merged 20 commits into from May 4, 2012

2 participants

@fism88
Collaborator

Should be able to save birthdays for different users. #163

Added cancel button to each of the sections in the edit profile page. #165

Added default birthday values to upcoming dates for Alice and Jeff in initial data #273

Able to save Interested in field now #163

Added more internationalisation (i18n) to profile html file #147

Able to save relationship status now #163

@amshali amshali commented on an outdated diff May 3, 2012
app/controllers/Profiles.java
@@ -41,10 +41,12 @@ public static void updateInformation(String birthday, String relationshipStatus,
Profile profile = Profile.find("owner = ?", user).first();
profile.religion = religion;
DateFormat birthday_formatting = new SimpleDateFormat("MM/dd/yyyy");
- try{
- profile.birthday = (Date) birthday_formatting.parse(birthday);
- } catch (java.text.ParseException e) {
- e.printStackTrace();
+ if(birthday != null){
+ try{
+ profile.birthday = (Date) birthday_formatting.parse(birthday);
+ } catch (java.text.ParseException e) {
+ e.printStackTrace();
@amshali
Collaborator
amshali added a line comment May 3, 2012

you need to do something proper on the exception. It is very important to handle it well. We don't want to show the user the exception trace. Handle it, show a proper message to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@amshali amshali commented on an outdated diff May 3, 2012
app/controllers/Profiles.java
@@ -57,6 +59,8 @@ public static void updateInformation(String birthday, String relationshipStatus,
e.printStackTrace();
}
}
+// if(profile.relationshipStatus != null)
@amshali
Collaborator
amshali added a line comment May 3, 2012

remove the comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@amshali amshali commented on the diff May 3, 2012
app/views/Users/profile.html
@@ -121,11 +126,12 @@
</tr>
</table>
<input type="submit" value="Save" id="updateInformation" />
+ <input type="reset" value="Cancel">
@amshali
Collaborator
amshali added a line comment May 3, 2012

What will the Cancel do? Have you tested it?

@fism88
Collaborator
fism88 added a line comment May 3, 2012

Yes I tested it and it reverts back to the previous state for all the fields associated with it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@amshali
Collaborator

What's up?

@fism88
Collaborator

Does this now look better for the error messages?

@amshali
Collaborator

No. Look how errors are handled here:
http://www.playframework.org/documentation/1.2.4/guide4

@amshali
Collaborator

Also look at the signup page and how errors are handled there,

@fism88
Collaborator

Right, the validation. I'm still working on the regex and testing because I am using validation.match to handle user input errors for calendar related fields.

@amshali
Collaborator

As soon as you send an update I will review and merge it. Make sure you pull first.

@fism88
Collaborator

Okay I moved the error messages to display all of them at the top of the left panel in red and tested to see if saving still works.

@fism88
Collaborator

Just a heads up, I fixed some other things as well

@amshali
Collaborator

let me test it

@amshali amshali merged commit 9de6b17 into w7cook:master May 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment