mirror of
https://github.com/idanoo/nzart-exam-generator
synced 2025-07-03 14:52:17 +00:00
Added result tracking
This commit is contained in:
parent
0c6a5f3833
commit
b8794f6dc5
8 changed files with 167 additions and 47 deletions
|
@ -22,18 +22,34 @@ class Result extends DataItem {
|
|||
return json_decode($this->resultdata_result, true);
|
||||
}
|
||||
|
||||
public function setScore($score)
|
||||
{
|
||||
$this->resultdata_score = json_encode($score);
|
||||
}
|
||||
|
||||
public function getScore()
|
||||
{
|
||||
return json_decode($this->resultdata_score, true);
|
||||
}
|
||||
|
||||
public function setUser($userId)
|
||||
{
|
||||
$this->resultdata_user = $userId;
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
return $this->resultdata_user;
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$db = new db();
|
||||
$db->query("INSERT INTO result(result_time, resultdata_user, resultdata_result)
|
||||
VALUES(:qTime, :qUser, :qContent)");
|
||||
$db->query("INSERT INTO result(result_time, resultdata_user, resultdata_result, resultdata_score)
|
||||
VALUES(:qTime, :qUser, :qContent, :qScore)");
|
||||
$db->bind("qTime", time());
|
||||
$db->bind("qUser", $this->resultdata_user);
|
||||
$db->bind("qScore", $this->resultdata_score);
|
||||
$db->bind("qContent", $this->resultdata_result);
|
||||
return $db->execute();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue