Skip to content

Conversation

@cmn53
Copy link

@cmn53 cmn53 commented May 29, 2018

TREK

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What does it mean for code to be asynchronous?
Describe a piece of your code that executes asynchronously. How did this affect the way you structured it?
What kind of errors might the API give you? How did you choose to handle them?
Do you have any recommendations on how we could improve this project for the next cohort?

@droberts-sea
Copy link

TREK

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene yes
Comprehension questions you did not answer these!
Functionality
Click a button to list trips yes
Click a trip to see trip details yes
Fill out a form to reserve a spot yes
Errors are reported to the user yes
Styling yes - looks great!
Under the Hood
Trip data is retrieved using from the API yes
JavaScript is well-organized and easy to read mostly - see inline
HTML is semantic yes
Overall Excellent job overall! This code is for the most part well-organized and easy to read, and it's clear the learning goals of this assignment were met. I especially appreciate the care you put into error handling. I've left a couple inline comments for you to review below, but in general I am quite happy with this submission. Keep up the hard work!


html += `<h2>Trip Details</h2>
<div>
<h3>Name: ${this.innerHTML}<h3>

Choose a reason for hiding this comment

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

It might make sense to break the code to render trip details out into a separate function - as is, this function is doing two things (making the request, and rendering data). See also http://callbackhell.com/

$(document).ready(() => {
$("#load-trips").click(loadTrips);
$("#trip-list").on("click", "li", loadTripDetails);
$("#trip-list").on("click", "li", loadReserveTrip);

Choose a reason for hiding this comment

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

Rather than running loadReserveTrip immediately when a trip is clicked, it might work better to only load it when the GET request for the individual trip comes back. That is, call that function from within the then callback of loadTripDetails.

const loadReserveTrip = function loadReserveTrip() {

const reserveTrip = $("#reserve-trip");
reserveTrip.empty();

Choose a reason for hiding this comment

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

I like the idea of breaking this code out into a separate function. Good organization!

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