SMILEConsortium / smile_teacher_android

The SMILE Teacher Android App
http://www.smileconsortium.org
Apache License 2.0
1 stars 2 forks source link

Teacher needs to know if there was an error on deletion and app should handle errors #91

Closed truedat101 closed 10 years ago

truedat101 commented 10 years ago

Right now, if a teacher goes to delete a question, they will receive a toast message that says "deleting". There is no further confirmation to the teacher that it succeeded or failed. In some cases, the question number will be removed from the teacher's question list. In other cases, it doesn't get removed. There may be some errors during deletion, so it is important to display an error message. Please review the analysis below.

Right now on line 122 of https://github.com/SMILEConsortium/smile_teacher_android/blob/dev/src/main/java/org/smilec/smile/bu/SmilePlugServerManager.java, if you make a call to the AbstractBaseManager.delete(), it should return an InputStream. You still need to parse the response body from the DELETE call to /smile/question.NUMBER.json . Are you planning to do that? As we discussed, you should not delete a row until you've verified that the response was 200, and that there was no error attribute in the JSON response.

Here is an example of how to do this: http://examples.javacodegeeks.com/core-java/json/json-parsing-with-gson/

You make a request to the server [teacher app] -- DELETE /smile/question/3.json --> [smileserver] | <--- 200, { status: 'ok', error: 'hey there was a problem }

If you read the message body, you will have JSON, which should be checked for existence of an error attribute. If there is no error, then proceed with the removal of the question from the list.

This is related to #60 .

truedat101 commented 10 years ago

I'll tackle this one tomorrow.

truedat101 commented 10 years ago

oops it's fixed.