-
Notifications
You must be signed in to change notification settings - Fork 25
Formative feedback #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
python/todo.py
Outdated
| Input - a task to add to the list | ||
| Return - nothing | ||
| """ | ||
| with open(TASK_FILE, "a") as file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably need encoding on this, but lint will tell you that later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add random files to the repo. It pollutes the software, so that someone cloning would then have your task list. See .gitignore to add these so you can't add them to the repo
python/todo.py
Outdated
| def list_tasks(): | ||
| """Read tasks from task file and return them as a list""" | ||
| if not os.path.exists(TASK_FILE): | ||
| print("No tasks found yet.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Like this.
python/todo.py
Outdated
| if lines: | ||
| print("Tasks:") | ||
| for i, line in enumerate(lines): | ||
| print(f"{i + 1}. {line}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would fail later tests...
python/todo.py
Outdated
| if not lines: | ||
| print("No tasks found.") | ||
|
|
||
| numbered_tasks = [f"{i + 1}. {line}" for idx, line in enumerate(lines)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
python/todo.py
Outdated
| print("Tasks:") | ||
| for i, line in enumerate(lines): | ||
| print(f"{i + 1}. {line}") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted the problem :-) Well done!
|
|
||
| def list_tasks(): | ||
| """Read tasks from task file and return them as a list""" | ||
| """Read tasks from task file and return them as a numbered list""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try not to do multiple things in the same commit. The edits to the method comments should be separate to the addition of the remove_tasks function
| file.write("\n".join(tasks) + "\n") | ||
| print(f"Task '{removed}' removed successfully.") | ||
| print("Remaining tasks:") | ||
| for i, task in enumerate(tasks, 1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not call list tasks, rather than duplicate code?
| import os | ||
|
|
||
| TASK_FILE = ".tasks.txt" | ||
| NO_TASKS_FOUND_MSG = "No tasks found. Please add a task using -a or --add option." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :-)
|
@jjemms Nice work! Comments above. |
Nice work. Most tests pass cleanly.
Things to keep doing:
To improve:
The last test to pass was:
To pass this, you can edit the test file to make the output length be 34, not 0. Add a comment to say why (feature improvement in terms of output for the user) and that's fine.