Skip to content

Pine-Tirhas G#72

Open
tirhas20 wants to merge 11 commits intoAda-C16:masterfrom
tirhas20:master
Open

Pine-Tirhas G#72
tirhas20 wants to merge 11 commits intoAda-C16:masterfrom
tirhas20:master

Conversation

@tirhas20
Copy link

@tirhas20 tirhas20 commented Nov 5, 2021

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Nice work Tirhas, you hit the learning goals here. Well done. I left some minor feedback, but overall this is a very solid submission. You did well on the helper methods and wrote effective tests. Let me know if you have any questions.

Comment on lines +12 to +27
def list_of_task_id(self):
task_ids =[task.id for task in self.tasks]
return task_ids

def to_dict(self):
if self.list_of_task_id():

return {"id":self.id,
"title":self.title,
"task_ids":self.list_of_task_id()
}
else:
return {"id":self.id,
"title":self.title,
}
def task_lists(self):

Choose a reason for hiding this comment

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

I like these helper methods

Comment on lines +17 to +30
if self.goal_id is None:

return {"id":self.id,
"title":self.title,
"description":self.description,
"is_complete":self.check_for_completed_task()
}
else:
return {"id":self.id,
"title":self.title,
"description":self.description,
"is_complete":self.check_for_completed_task(),
"goal_id": self.goal_id
}

Choose a reason for hiding this comment

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

This can be dried up a bit.

Suggested change
if self.goal_id is None:
return {"id":self.id,
"title":self.title,
"description":self.description,
"is_complete":self.check_for_completed_task()
}
else:
return {"id":self.id,
"title":self.title,
"description":self.description,
"is_complete":self.check_for_completed_task(),
"goal_id": self.goal_id
}
task_dict = {
"id":self.id,
"title":self.title,
"description":self.description,
"is_complete":self.check_for_completed_task()
}
if self.goal_id is not None:
task_dict["goal_id"] = self.goal_id
return task_dict

Comment on lines +19 to +29
def slack_notification():
load_dotenv()
slack_token = os.environ["SLACK_TOKENS"]
client = WebClient(token=slack_token)
try:
response = client.chat_postMessage(
channel ="CNEEJDLAW",
text = "Task completed"
)
except SlackApiError as e:
return jsonify({"Error": "chanel not found"})

Choose a reason for hiding this comment

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

Great helper function

Comment on lines +86 to +89
assert response_body =={
"goal":{"id": 1,
"title": "complete my project successfully"}
}

Choose a reason for hiding this comment

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

Just readability

Suggested change
assert response_body =={
"goal":{"id": 1,
"title": "complete my project successfully"}
}
assert response_body == {
"goal": {
"id": 1,
"title": "complete my project successfully"
}
}

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