Fix the completed boolean of tasks in the class and set the toast accordingly
This commit is contained in:
parent
6222ca71a4
commit
8f47e90251
|
|
@ -58,12 +58,13 @@ class Task implements JsonSerializable {
|
|||
}
|
||||
|
||||
public function getCompleted($flag = 0) {
|
||||
$completed = (is_null($this->getCompleteTime())) ? false : true;
|
||||
switch ($flag) {
|
||||
case AppDB::BOOLEANDB:
|
||||
return ($this->completed) ? "true" : "false";
|
||||
return ($completed) ? "true" : "false";
|
||||
break;
|
||||
default:
|
||||
return $this->completed;
|
||||
return $completed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -220,6 +221,7 @@ class Task implements JsonSerializable {
|
|||
'createdate' => $this->getCreateTime(SHORTDATE),
|
||||
'duetime' => $this->getDueTime(),
|
||||
'duedate' => $this->getDueTime(SHORTDATE),
|
||||
'completed' => $this->getCompleted(),
|
||||
'completetime' => $this->getCompleteTime(),
|
||||
'completedate' => $this->getCompleteTime(SHORTDATE)
|
||||
];
|
||||
|
|
|
|||
|
|
@ -113,7 +113,11 @@ function setTaskComplete(incomplete = false) {
|
|||
if ( data.error ) {
|
||||
toastr.error(data.message, "Submission Error");
|
||||
} else {
|
||||
if ( data.task.completed ) {
|
||||
toastr.success(data.message, "Task Complete");
|
||||
} else {
|
||||
toastr.success(data.message, "Task Incomplete");
|
||||
}
|
||||
getTasks();
|
||||
updateImage();
|
||||
resetForm(true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user