Open
Conversation
…eate_task, get_one_task, tasks_index.Adds to_json() method to Task.
…e. Wave 1 responses dried up with implementation of to_json().
by title. Wave 2 passes all tests.
to routes.py. Wave - All tests passing.
mark_task_complete in routes.py
get_one_goal, goals_index, delete_goal, update_goal, and create_goal. All tests for wave 5 pass.
class Goal and child class Task. Two routes added to routes.py for wave 6.
Modifies task and goal to one-to-many relationship. Adds two routes
as opposed to slack.WebClient() with slack package.
kaidamasaki
reviewed
May 21, 2021
kaidamasaki
left a comment
There was a problem hiding this comment.
Great job!
I called out a few little ways to clean up your code but overall everything looked really good! Well done!
| params={ | ||
| "channel": "task-notifications", | ||
| "text": f"Someone just completed the task {task.title}"}, | ||
| headers={'Authorization': os.environ['SLACK_TOKEN']}) |
There was a problem hiding this comment.
This should have been named SLACK_API_KEY (to match our .env in Learn) that's why the tests failed:
Suggested change
| headers={'Authorization': os.environ['SLACK_TOKEN']}) | |
| headers={'Authorization': os.environ['SLACK_API_KEY']}) |
Comment on lines
+32
to
+33
| from app.models.task import Task | ||
| from app.models.goal import Goal |
There was a problem hiding this comment.
You didn't need to import Task or Goal here since they are unused.
| __tablename__ = "goals" | ||
|
|
||
| def to_json(self): | ||
| if self.tasks != []: |
There was a problem hiding this comment.
This can be simplified as:
Suggested change
| if self.tasks != []: | |
| if self.tasks: |
Since empty lists are falsey.
| is_complete = False | ||
| else: | ||
| is_complete = True | ||
| if self.goal_id != None: |
There was a problem hiding this comment.
Remember, None is falsey:
Suggested change
| if self.goal_id != None: | |
| if self.goal_id: |
Comment on lines
+12
to
+16
| is_complete = self.completed_at | ||
| if self.completed_at == None: | ||
| is_complete = False | ||
| else: | ||
| is_complete = True |
There was a problem hiding this comment.
This can be simplified as:
Suggested change
| is_complete = self.completed_at | |
| if self.completed_at == None: | |
| is_complete = False | |
| else: | |
| is_complete = True | |
| is_complete = self.completed_at != None |
|
|
||
| @goals_bp.route("/<goal_id>/tasks", methods=["GET"], strict_slashes=False) | ||
| def get_tasks_from_goal_id(goal_id): | ||
| goal = Goal.query.get_or_404(goal_id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.