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

Seaturtles_Ashley_Benson #113

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

Conversation

bensonaa1988
Copy link

No description provided.

Copy link

@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.

Nice job!

Your tests are all passing and your code is very readable. Great job thinking about how to separate the various responsibilities of your code. Deciding where things should go is really tricky, and may often require making up new types (not Models, just Python types) to hold a particular responsibility (SRP). Keep at it!

Overall, looks good!

@@ -0,0 +1 @@
web: gunicorn 'app:create_app()'

Choose a reason for hiding this comment

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

You have the Procfile required for deployment, but didn't do the deployment?

if test_config is None:
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get(
if not test_config:
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

Choose a reason for hiding this comment

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

This and line 22 are the same in both branches, so it it could be moved outside the conditions (it used to be line 15).

Comment on lines +39 to +62
# def create_app(test_config=None):
# app = Flask(__name__)
# app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False

# if test_config is None:
# app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get(
# "SQLALCHEMY_DATABASE_URI")
# else:
# app.config["TESTING"] = True
# app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get(
# "SQLALCHEMY_TEST_DATABASE_URI")
# print("SQLALCHEMY_DATABASE_URI is " + app.config["SQLALCHEMY_DATABASE_URI"]);
# # Import models here for Alembic setup
# from app.models.tasks import Task
# from app.models.goal import Goal

# db.init_app(app)
# migrate.init_app(app, db)

# # Register Blueprints here
# from .routes import tasks_bp
# app.register_blueprint(tasks_bp)

# return app

Choose a reason for hiding this comment

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

What's this code doing here? It looks almost the same, but doesn't have goals. Try to clean up things like this before submitting, or add some other label for why it's here. Even better, practice using branches and move code that you'd like to hang onto for reference to a side branch.


from wsgiref.util import request_uri

Choose a reason for hiding this comment

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

This looks like a stray import.


Choose a reason for hiding this comment

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

It looks like you were thinking about moving the goal routes to their own file, which is a great idea. But since everything stayed in this routes.py, I'd remove the empty goal_routes.py.

description = db.Column(db.String, nullable=False)
completed_at = db.Column(db.DateTime)
goal_id = db.Column(db.Integer, db.ForeignKey('goal.goal_id'), nullable=True)
goals = db.relationship("Goal")

Choose a reason for hiding this comment

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

Since you used backref in Goal, we don't need this relationship here. If you do want to have both entries in both places, prefer back_populates.

Comment on lines +22 to +23
if self.goal_id:
hash_map["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.

👍 Nice way to selectively add the goal id key for tasks that have one.

def get_task_for_goal(goal_id):
goal = validate_element(goal_id, "goal")
tasks = Task.query.filter_by(goal=goal)

Choose a reason for hiding this comment

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

This works, but since you set up relationships, you could also do

    tasks = goal.tasks

Comment on lines +184 to +187

for task in tasks:
task_list.append(task.to_json())

Choose a reason for hiding this comment

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

Consider a list comprehension.



# def error_message(message, status_code):

Choose a reason for hiding this comment

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

There's 150 lines of commented code after this. Be sure to clean that up from a submission, such as by moving it to a side branch.

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