COSC381-2024Fall / Todo-List-CLI

This project is a command-line to-do list manager, where users can add, view, and delete tasks. The project is incomplete, with room for improvements and bug fixes.
MIT License
0 stars 0 forks source link

Adjust "Add/Update a due date to a task" feature to better format the updated task with date #31

Closed Maryam1029 closed 3 hours ago

Maryam1029 commented 6 hours ago

Instead of outputting the updated task as ('task', 'date'), format it instead as date: task.

You can do this by adjusting the add_task_date function like this (code was adjusted with the help of ChatGPT):

def add_task_date(self, task_number, due_date):
    """Add a due date to a task."""
    if task_number <= 0 or task_number > len(self.tasks):
        print("Invalid task number!")
    else:
        task = self.tasks[task_number - 1]
        if type(task) is str:
            self.tasks[task_number - 1] = (task, due_date)
            self.tasks[task_number - 1] = f"{due_date}: {task}" 
        else:
            task_name = task[0]
            self.tasks[task_number - 1] = f"{due_date}: {task_name}" 

        print(f'Task updated: {self.tasks[task_number - 1]}')
sjiang1 commented 6 hours ago

Okay!

MrTyler97 commented 6 hours ago

Taking this on 🫡