Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions lbplanner/classes/helpers/kanban_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,25 @@ public static function get_entry(int $userid, int $cmid): ?kanbanentry {
public static function set_entry(kanbanentry $entry): void {
global $DB, $CFG;

$DB->delete_records(self::TABLE, ['userid' => $entry->userid, 'cmid' => $entry->cmid]);
try {
$DB->delete_records(self::TABLE, ['userid' => $entry->userid, 'cmid' => $entry->cmid]);
} catch (\dml_exception $e) {
// Needed for low-reporting contexts such as a prod server.
echo 'error while trying to delete preexisting kanban entries: '.$e->getMessage()."\nFurther info:\n".$e->debuginfo;
var_dump($entry);
throw $e;
}
if ($entry->column !== KANBANCOL_TYPE_NUMERIC::BACKLOG) {
$table = $CFG->prefix . self::TABLE;
// Moodle is too stupid to compensate for 'column' being a keyword so I need to shit my own ass manually.
$newid = $DB->execute("INSERT INTO {$table} VALUES (null,?,?,?)", [$entry->userid, $entry->cmid, $entry->column]);
try {
// Moodle is too stupid to compensate for 'column' being a keyword so I need to shit my own ass manually.
$newid = $DB->execute("INSERT INTO {$table} VALUES (null,?,?,?)", [$entry->userid, $entry->cmid, $entry->column]);
} catch (\dml_exception $e) {
// Needed for low-reporting contexts such as a prod server.
echo 'error while trying to insert new kanban entry: '.$e->getMessage()."\nFurther info:\n".$e->debuginfo;
var_dump($entry);
throw $e;
}
$entry->set_fresh($newid);
}
}
Expand Down
Loading