|
@@ -66,25 +66,20 @@ export default class ReminderApp {
|
|
|
( 3 ) Take result from ( 2 ) and toggle that reminder's completion (this._remindersHandler.toggleCompletion)
|
|
( 3 ) Take result from ( 2 ) and toggle that reminder's completion (this._remindersHandler.toggleCompletion)
|
|
|
( 4 ) Logger.log('\n 🏁 Reminder Completion Toggled');
|
|
( 4 ) Logger.log('\n 🏁 Reminder Completion Toggled');
|
|
|
*/
|
|
*/
|
|
|
- // 檢查是否有提醒
|
|
|
|
|
|
|
+ // Check if there are any reminders
|
|
|
if (this._remindersHandler.size() === 0) {
|
|
if (this._remindersHandler.size() === 0) {
|
|
|
Logger.log("\n ⚠️ You have no reminders");
|
|
Logger.log("\n ⚠️ You have no reminders");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // (1) 顯示所有提醒
|
|
|
|
|
Logger.logReminders(this._remindersHandler.reminders);
|
|
Logger.logReminders(this._remindersHandler.reminders);
|
|
|
|
|
|
|
|
- // (2) 詢問用戶選擇要切換完成狀態的提醒編號
|
|
|
|
|
const reminderIndex = this.getUserChoice("Choose a reminder number to toggle", true);
|
|
const reminderIndex = this.getUserChoice("Choose a reminder number to toggle", true);
|
|
|
|
|
|
|
|
- // 將用戶選擇從字符串轉換為基於零的索引
|
|
|
|
|
const index = parseInt(reminderIndex) - 1;
|
|
const index = parseInt(reminderIndex) - 1;
|
|
|
|
|
|
|
|
- // (3) 切換所選提醒的完成狀態
|
|
|
|
|
this._remindersHandler.toggleCompletion(index);
|
|
this._remindersHandler.toggleCompletion(index);
|
|
|
|
|
|
|
|
- // (4) 記錄提醒完成狀態已切換
|
|
|
|
|
Logger.log("\n 🏁 Reminder Completion Toggled");
|
|
Logger.log("\n 🏁 Reminder Completion Toggled");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -103,30 +98,24 @@ export default class ReminderApp {
|
|
|
( 5 ) If user wishes to also toggle reminder status, do so (this._remindersHandler.toggleCompletion)...feeding in ( 2 )
|
|
( 5 ) If user wishes to also toggle reminder status, do so (this._remindersHandler.toggleCompletion)...feeding in ( 2 )
|
|
|
( 6 ) Logger.log('\n 🏁 Reminder Modified');
|
|
( 6 ) Logger.log('\n 🏁 Reminder Modified');
|
|
|
*/
|
|
*/
|
|
|
- // 檢查是否有提醒
|
|
|
|
|
|
|
+ // Check if there are any reminders
|
|
|
if (this._remindersHandler.size() === 0) {
|
|
if (this._remindersHandler.size() === 0) {
|
|
|
Logger.log("\n ⚠️ You have no reminders");
|
|
Logger.log("\n ⚠️ You have no reminders");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // (1) 顯示所有提醒
|
|
|
|
|
Logger.logReminders(this._remindersHandler.reminders);
|
|
Logger.logReminders(this._remindersHandler.reminders);
|
|
|
|
|
|
|
|
- // (2) 讓用戶選擇要編輯的提醒編號
|
|
|
|
|
const reminderIndex = this.getUserChoice("reminder number to edit", true);
|
|
const reminderIndex = this.getUserChoice("reminder number to edit", true);
|
|
|
|
|
|
|
|
- // (3) 獲取用戶為提醒輸入的新描述
|
|
|
|
|
const newDescription = this.getUserChoice("new reminder description", false);
|
|
const newDescription = this.getUserChoice("new reminder description", false);
|
|
|
|
|
|
|
|
- // (4) 修改提醒
|
|
|
|
|
this._remindersHandler.modifyReminder(parseInt(reminderIndex) - 1, newDescription);
|
|
this._remindersHandler.modifyReminder(parseInt(reminderIndex) - 1, newDescription);
|
|
|
|
|
|
|
|
- // (5) 如果用戶希望切換提醒狀態
|
|
|
|
|
if (ReminderApp.checkUserToggleChoice()) {
|
|
if (ReminderApp.checkUserToggleChoice()) {
|
|
|
this._remindersHandler.toggleCompletion(parseInt(reminderIndex) - 1);
|
|
this._remindersHandler.toggleCompletion(parseInt(reminderIndex) - 1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // (6) 記錄提醒已被修改
|
|
|
|
|
Logger.log("\n 🏁 Reminder Modified");
|
|
Logger.log("\n 🏁 Reminder Modified");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -171,16 +160,14 @@ export default class ReminderApp {
|
|
|
- If not, then call this.searchDescriptions(keyword) and look through each
|
|
- If not, then call this.searchDescriptions(keyword) and look through each
|
|
|
individual reminder.
|
|
individual reminder.
|
|
|
*/
|
|
*/
|
|
|
- // 檢查是否有提醒
|
|
|
|
|
|
|
+ // Check if there are any reminders
|
|
|
if (this._remindersHandler.size() === 0) {
|
|
if (this._remindersHandler.size() === 0) {
|
|
|
Logger.log("\n ⚠️ You have no reminders");
|
|
Logger.log("\n ⚠️ You have no reminders");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // (1) 詢問用戶輸入搜索關鍵字
|
|
|
|
|
const keyword = this.getUserChoice("Enter a search keyword", false);
|
|
const keyword = this.getUserChoice("Enter a search keyword", false);
|
|
|
|
|
|
|
|
- // (2) 執行搜索並記錄結果
|
|
|
|
|
const searchResults = this._remindersHandler.search(keyword);
|
|
const searchResults = this._remindersHandler.search(keyword);
|
|
|
Logger.logSearchResults(searchResults);
|
|
Logger.logSearchResults(searchResults);
|
|
|
}
|
|
}
|
|
@@ -195,13 +182,11 @@ export default class ReminderApp {
|
|
|
otherwise
|
|
otherwise
|
|
|
( 1 ) Logger.logGroupedReminders(this._remindersHandler.groupByTag());
|
|
( 1 ) Logger.logGroupedReminders(this._remindersHandler.groupByTag());
|
|
|
*/
|
|
*/
|
|
|
- // 檢查是否有提醒
|
|
|
|
|
|
|
+ // Check if there are any reminders
|
|
|
if (this._remindersHandler.size() === 0) {
|
|
if (this._remindersHandler.size() === 0) {
|
|
|
Logger.log("\n ⚠️ You have no reminders");
|
|
Logger.log("\n ⚠️ You have no reminders");
|
|
|
} else {
|
|
} else {
|
|
|
- // 獲取按標籤分組的提醒
|
|
|
|
|
const groupedReminders = this._remindersHandler.groupByTag();
|
|
const groupedReminders = this._remindersHandler.groupByTag();
|
|
|
- // 記錄分組的提醒
|
|
|
|
|
Logger.logGroupedReminders(groupedReminders);
|
|
Logger.logGroupedReminders(groupedReminders);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|