-
Notifications
You must be signed in to change notification settings - Fork 71
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
Paper - Kaylyn Cardella #65
base: master
Are you sure you want to change the base?
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.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been named SLACK_API_KEY
(to match our .env in Learn) that's why the tests failed:
headers={'Authorization': os.environ['SLACK_TOKEN']}) | |
headers={'Authorization': os.environ['SLACK_API_KEY']}) |
from app.models.task import Task | ||
from app.models.goal import Goal |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified as:
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember, None
is falsey:
if self.goal_id != None: | |
if self.goal_id: |
is_complete = self.completed_at | ||
if self.completed_at == None: | ||
is_complete = False | ||
else: | ||
is_complete = True |
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 can be simplified as:
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) |
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 use of get_or_404
!
No description provided.