mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 01:33:19 +00:00
Fix tasks being unscheduled if the day for the task already exists
This commit is contained in:
parent
dee7a6fa42
commit
3e7c9b150a
6 changed files with 26 additions and 6 deletions
|
@ -96,9 +96,13 @@ void UiState::setupCallbacks()
|
|||
assert(source);
|
||||
auto task = source->getTaskById(taskId);
|
||||
assert(task);
|
||||
if (!task->checked() && !task->hasDate() && !task->hasEvent()) {
|
||||
task->setDate(mirai::Date(mirai::Date(std::chrono::system_clock::now())));
|
||||
}
|
||||
task->setChecked(!task->checked());
|
||||
// task->getState() == mirai::DONE ? task->markAsUndone() : task->markAsDone();
|
||||
miraiInstance_->save();
|
||||
view_.update();
|
||||
reloadTasks();
|
||||
});
|
||||
|
||||
mainWindow_->global<ui::Backend>().on_source_clicked([&](int index) {
|
||||
|
@ -156,6 +160,8 @@ void UiState::setupCallbacks()
|
|||
});
|
||||
|
||||
mainWindow_->global<ui::Backend>().on_create_task([&](ui::NewTaskData newTaskData) {
|
||||
std::cout << "Task date: " << newTaskData.date.year << " " << newTaskData.date.day
|
||||
<< std::endl;
|
||||
std::optional<mirai::Date> date = std::nullopt;
|
||||
if (newTaskData.date.year != 0) {
|
||||
date = SlintDateToMiraiDate(newTaskData.date);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue