Skip to content

Commit

Permalink
Issue #25: Changing main flow to if in evaluateEvent method
Browse files Browse the repository at this point in the history
  • Loading branch information
belaaiza committed Jun 6, 2016
1 parent 8c38737 commit 41ab148
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/src/main/java/dao/EventEvaluationDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ public void evaluateEvent(EventEvaluation evaluation){
JSONObject findEvaluation = searchEventEvaluation(evaluation.getEventId(),
evaluation.getUserId());

if(findEvaluation==null){
if(findEvaluation!=null){
QUERY = "UPDATE participate SET grade = \"" +evaluation.getRating() + "\" " +
"WHERE idEvent = \"" + evaluation.getEventId() + "\" AND idUser = \"" +
evaluation.getUserId() + "\"";
}else{
QUERY = "INSERT INTO participate(grade, idUser, idEvent) VALUES (\"" +
evaluation.getRating() + "\"," +
"\"" + evaluation.getUserId() + "\"," +
"\"" + evaluation.getEventId() + "\")";
}else{
QUERY = "UPDATE participate SET grade = \"" +evaluation.getRating() + "\" " +
"WHERE idEvent = \"" + evaluation.getEventId() + "\" AND idUser = \"" +
evaluation.getUserId() + "\"";

}

executeQuery(QUERY);
Expand Down

0 comments on commit 41ab148

Please sign in to comment.