T201704041122

This commit is contained in:
Leander
2017-04-04 11:23:03 +02:00
parent a5cdfc9066
commit f1f38bd725
3 changed files with 6 additions and 1 deletions

View File

@@ -19,3 +19,4 @@
13101 - User ID not specified
13102 - No valid time specified
13103 - No chosen answer specified
13104 - No game for specified user

View File

@@ -72,6 +72,8 @@ class Database
return 'No valid time specified. This is an internal error.';
case 13103:
return 'No chosen answer specified. This is an internal error.';
case 13104:
return 'No game for specified user name. This is an internal error.';
default:
return 'An unknown error occurred.';
}

View File

@@ -25,7 +25,6 @@
$correct_answer = $db->query('SELECT "current_right_answer" FROM "Games" WHERE "ID" = $1', array($uid))
['data'][0]['current_right_answer'];
print_r(pg_last_error());
$correct = $correct_answer == $chosen_answer ? true : false;
$score = $correct_answer == $chosen_answer ? calculate_points($time) : 0;
if($uid == '') {
@@ -34,6 +33,9 @@
$error = 13102;
} else if($chosen_answer == -1) {
$error = 13103;
} else if($db->query('SELECT EXISTS (SELECT 1 FROM "Games" WHERE "ID" = $1)', array($uid))['data'][0]['exists'] == 'f') {
$error = 13104;
print 'no game';
} else {
// points in table
}