Skip to content

Possum - Madi Rei#37

Open
Madi-Rei97 wants to merge 16 commits intoAda-C24:mainfrom
Madi-Rei97:main
Open

Possum - Madi Rei#37
Madi-Rei97 wants to merge 16 commits intoAda-C24:mainfrom
Madi-Rei97:main

Conversation

@Madi-Rei97
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@anselrognlie anselrognlie left a comment

Choose a reason for hiding this comment

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

Looks good overall, but please review my comments, and let me know if you have any questions.

Comment thread tests/test_wave_01.py Outdated
Comment thread tests/test_wave_05.py Outdated
Comment thread tests/test_wave_07.py
Comment thread migrations/versions/daa931b58bae_.py
Comment thread migrations/versions/c2a8d7dbbc52_adds_task_model.py
Comment thread app/models/task.py
Comment thread app/routes/goal_routes.py Outdated
Comment thread app/routes/goal_routes.py
Comment thread app/routes/goal_routes.py
Comment on lines +31 to +34
return {
"id": goal.id,
"task_ids": task_ids
}, 200
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Rather than hard-coding this dict result here, we could create an additional instance method on Goal to generate this output, or a standalone helper. THat could help tidy up this function.

Comment thread app/routes/goal_routes.py
Comment on lines +52 to +53
"id": goal.id,
"title": goal.title,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Notice that the id and title keys here are the same as for a regular Goal GET, for which we wrote the to_dict helper. Here, we could use our to_dict to get the regular result dictionary, and then add in the tasks key with the loaded task data.

Or we could make a different helper that itself uses the Goal to_dict for its basic structure, but adds in the Task content itself. This would tidy up the response generation for this route.

Copy link
Copy Markdown

@anselrognlie anselrognlie left a comment

Choose a reason for hiding this comment

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

👍 Thanks for the update. Looks good.

Comment thread app/models/task.py
Comment on lines 31 to +32
task_as_dict["is_complete"] = (False if self.completed_at is None else
self.completed_at)
True)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 This will now consistently return a boolean value.

Here, even though we only use this definition of being complete in just this function, it would still be worth moving it to a model instance method (like is_complete()) so that the calculated value could be available in other places, and here, calling that function would simplify understanding the output logic for the reader.

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