Skip to content

Conversation

@shirley1chu
Copy link

TREK

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What does it mean for code to be asynchronous? That part of code continues to execute, while other parts of the program are executing at the same time.
Describe a piece of your code that executes asynchronously. How did this affect the way you structured it? The form loads at the same time as the trip details page, so I would say that the code responsible for loading the form and the trip details are asynchronous.
What kind of errors might the API give you? How did you choose to handle them? I didn't run into any errors, because I parsed the JSON object based off of the fields in contained (using iteration), instead of searching for specific fields.
Suppose you needed to routinely find a specific Trip in the list by it's ID field. Would it be advantageous to keep the list in order by the id field? Explain why or why not. Yes, it would be advantageous to order the list by ID field, for easier accesibility.

@CheezItMan
Copy link

TREK

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Good commit messages, reasonable number of commits
Comprehension questions Check, technically asynchronous code only appears to execute commands simultaneously. Asynchronous code is code you cannot predict when it will run or finish. It's unclear how ordering trips by ids would actually give you any advantage.
Functionality
Click a button to load and view a list of trips Check
Clicking the "load" button twice does not cause each trip to display twice Check
Click a trip to load and view trip details Check, but for some reason you're making 2 get requests, odd.
Clicking a different trip loads different details Check
Open network tab, then fill out a form to reserve a spot Check
Submitting the form only sends one POST request MISSING
Errors are reported to the user Only network errors are reported because... well the form isn't done.
Site is clearly laid out and easy to navigate Minimal styling
Under the Hood
Callback functions are not nested more than 2 levels deep Check, well done
Callback functions are given descriptive names Check
Code is generally well-organized and easy to read Check
All API calls have both success and error callbacks defined Check
HTML is semantic Check
CSS is DRY, uses CSS Grid, Flexbox, and/or Bootstrap Minimal CSS
Overall You hit many of the learning goals, but missed finishing the form, see my inline note about preventing default and other issues.

<form>`;

// sends GET request to endpoint
axios.get(tripURL)

Choose a reason for hiding this comment

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

Why do you do a get request to load the form. You shouldn't need 2 get requests to retrieve details about one trip.

tripForm(this.id)
});
$('#tripForm').on('submit', 'button', function () {
makeReservation(this.class)

Choose a reason for hiding this comment

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

You also need to add an event parameter and call event.preventDefault()

You also need to adjust the id, as your form is using trip-form

Lastly this.class should be this.className or event.target.className

const tripURL = tripListURL + '/' + tripID;


const form = `<form id='trip-form' class=${tripID}>

Choose a reason for hiding this comment

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

If you are generating the form new each time someone clicks on a trip, you will need to create a new event handler for the new form. The generated form wasn't around when the event handler was added.



const makeReservation = (tripID) => {
const tripURL = tripListURL + '/' + tripID;

Choose a reason for hiding this comment

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

tripID here is going to be undefined.

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