Skip to content
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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Paper - Kaylyn Cardella #65

wants to merge 11 commits into from

Conversation

kecardel
Copy link

No description provided.

kecardel added 11 commits May 6, 2021 18:30
…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.
Copy link

@kaidamasaki kaidamasaki left a 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']})

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:

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

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 != []:

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:

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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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:

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)

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants