Skip to content

Conversation

@i-vs
Copy link

@i-vs i-vs commented May 13, 2021

No description provided.

Copy link

@jmaddox19 jmaddox19 left a comment

Choose a reason for hiding this comment

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

SO AMAZING! It's clear you had so much fun with this project and that there was a lot of thoughtfulness in how this was implemented!

Comment on lines +12 to +21
def to_json_format(self):
task_to_json = {
"id": self.task_id,
"title": self.title,
"description": self.description,
"is_complete": True if self.completed_at is not None else False,
}
if self.goal is not None:
task_to_json["goal_id"] = self.goal
return task_to_json

Choose a reason for hiding this comment

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

Love this method!

tasks_bp = Blueprint("tasks", __name__, url_prefix="/tasks")
goals_bp = Blueprint("goals", __name__, url_prefix="/goals")

def err_404():

Choose a reason for hiding this comment

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

Nice little helper function :)

return jsonify({"task": single_task.to_json_format()})


def validate_field(field, dic):

Choose a reason for hiding this comment

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

SOOOO COOOL! This is honestly another level of developer thinking, to abstract out the very idea of validation into one function like this!

Choose a reason for hiding this comment

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

This could be taken even one step further by allowing an optional 3rd param for expected_type, which the function could use to verify that the type of the field is the type that's expected.

ongoing_task.completed_at = datetime.utcnow()
db.session.commit()

glados = GLaDOS()

Choose a reason for hiding this comment

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

Glados! Love it!

import os
import requests

class GLaDOS():

Choose a reason for hiding this comment

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

Oh my god this is my new favorite program OF ALL TIME!!!! :D

Comment on lines +16 to +21
def add_task_response_to_json(self):

return {
"id": self.goal_id,
"task_ids": [t.task_id for t in self.tasks]
}

Choose a reason for hiding this comment

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

So succinct!

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