Skip to content

Conversation

@griffifam
Copy link

TREK

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What does it mean for code to be asynchronous? That you can continue to interact with the user while other actions are happening.
Describe a piece of your code that executes asynchronously. How did this affect the way you structured it? My axios get requests - promises
What kind of errors might the API give you? How did you choose to handle them?
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. No, if you have the specific trip's ID, you could locate it based solely on that. The order would not matter. To search for it, the time complexity of that algorithm would be 0(1).

@tildeee
Copy link

tildeee commented Dec 12, 2018

TREK

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene x
Comprehension questions x
Functionality
Click a button to load and view a list of trips x
Click a trip to load and view trip details x
Fill out a form to reserve a spot
Errors are reported to the user
CSS is DRY and attractive, uses CSS Grid, flexbox, and/or Bootstrap x
Under the Hood
Trip data is retrieved using from the API x
JavaScript is well-organized and easy to read x
HTML is semantic x
Overall

Good work on this Amber Lynn. You have a lot of the code already written and built, but some of it isn't being used!

The main thing I see is that: You've written a nearly perfect/working function to handle submitting and creating a reservation from the form, but you never use it! You never set up a submit event listener so that when the form has a submit event, it actually calls the createReservation callback. So the form doesn't ever do anything when it gets submitted!

Once that is hooked up, your project is most of the way there for the rest of the requirements. I've left a couple of comments elsewhere that are minor.

Good work -- this project was almost all the way there to completing all of the waves!

tripDetail.append(`<li>About: ${response.data.about}</li>`);

//Automatically load Trip name in TripName input field
const input = $( "#TripName" );
Copy link

Choose a reason for hiding this comment

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

You don't have anything that matches the selector of #TripName ... At least, not with those uppercase letters. Watch your uppercase letters- things are usually case-sensitive in programming.


$("#tripName").val(function() {
return this.value + `${response.data.name}`;
});
Copy link

Choose a reason for hiding this comment

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

You're passing in a function as the parameter to .val(). Does .val() take in a function? .val() just takes in whatever you want to set as the value, so usually a string.

You could probably rewrite lines 154-156 as:

$("#tripName").val(`${response.data.name}`);

$("#tripName").val(function() {
return this.value + `${response.data.name}`;
});

Copy link

Choose a reason for hiding this comment

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

Here would be a great place to add the event listener for your form to listen to the submit event and call createReservation as its callback, like so:

$('.reserve-trip').on('submit', createReservation);

// owner: $('input[name = "owner"]').val()
// }

axios.post(URL, reservationData)
Copy link

Choose a reason for hiding this comment

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

Should you be posting to this URL? Check the value of the URL versus the value of the URL you want to post to in order to reserve trips as written in the documentation.

const reservationData = readFormData();
console.log(reservationData);

reportStatus('Sending pet data...');
Copy link

Choose a reason for hiding this comment

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

Hmmmmmm why does this say "pet"? Try not to copy-paste, try to re-type everything

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