Skip to content

Accelerate -Cadence #1

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

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

Accelerate -Cadence #1

wants to merge 8 commits into from

Conversation

cadence09
Copy link

No description provided.

if goal is None:
return make_response("",404)
if request.method == "GET":
if goal is not None:
Copy link

@tgoslee tgoslee Jun 19, 2021

Choose a reason for hiding this comment

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

you don't need this line again because you already did the check

Suggested change
if goal is not None:

})
return make_response(jsonify(goal_reponse),200)

else:
Copy link

@tgoslee tgoslee Jun 19, 2021

Choose a reason for hiding this comment

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

want to make sure request.mthod == 'POST here

Suggested change
else:
elif request.method == 'POST':

Comment on lines +182 to +183
goal_reponse=[]
goals = Goal.query.all()
Copy link

@tgoslee tgoslee Jun 19, 2021

Choose a reason for hiding this comment

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

move these after if request.method == 'GET':

if request.method == "GET":

for goal in goals:

Copy link

Choose a reason for hiding this comment

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

Suggested change

Comment on lines +14 to +19
def is_complete(completed_at):

if completed_at is None:
return False
else:
return True
Copy link

Choose a reason for hiding this comment

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

great use of helper functions

delete_id_response= f'Goal {goal_id} "{goal.title}" successfully deleted'
return make_response(jsonify({"details":delete_id_response}))

# @goals_bp.route('<goal_id>/tasks', methods=["GET", "POST"])
Copy link

Choose a reason for hiding this comment

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

To get tests passing for Wave 6 go ahead and implement what you started. Go back and look at the video if you need help with the implementation https://adaacademy.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=0e99645b-d46b-4e64-b5fe-ad48012e1e3e

Comment on lines +53 to +69
if request.method == "POST":
request_body = request.get_json()
if "title" not in request_body or "description" not in request_body or "completed_at" not in request_body:
return make_response({
"details": "Invalid data"
}, 400)
else:
new_task = Task(title=request_body["title"], description=request_body["description"], completed_at=request_body["completed_at"])
db.session.add(new_task)
db.session.commit()
return make_response(
{ "task": {
"id": new_task.task_id,
"title": new_task.title,
"description": new_task.description,
"is_complete": is_complete(new_task.completed_at)
}}, 201)
Copy link

Choose a reason for hiding this comment

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

💃🏽

Comment on lines +139 to +146
data_response = {
"task": {
"id": task.task_id,
"title": task.title,
"description": task.description,
"is_complete": True
}
}
Copy link

Choose a reason for hiding this comment

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

💃🏽

if task.completed_at is None :
return make_response(jsonify(data_response),200)

task.completed_at = None
Copy link

Choose a reason for hiding this comment

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

I would move this to line 156

Comment on lines +169 to +170
if task.completed_at is None :
return make_response(jsonify(data_response),200)
Copy link

Choose a reason for hiding this comment

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

you do not need this check here

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