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

Amy Lee -- Carets #40

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

Amy Lee -- Carets #40

wants to merge 14 commits into from

Conversation

ayjlee
Copy link

@ayjlee ayjlee commented Nov 27, 2017

TREK

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What does it mean for code to be asynchronous? Instead of reading and loading code from top to bottom, the code is running and loaded in the background at different times.
Describe a piece of your code that executes asynchronously. How did this affect the way you structured it? Certain forms and the list of trips are dynamically added through a function call that is triggered after a specific action is taken on the page (e.g. clicking the "All Trips" button). Because the list of trips is dynamically added, I had to nest the function call to drill into a specific trip within the getTrips function, but I had to define the function to get the details about a specific trip before I defined the function to get all Trips.
What kind of errors might the API give you? How did you choose to handle them? I chose to include a .fail promise to show a console message iff the API's server goes down, or there is missing data.
Do you have any recommendations on how we could improve this project for the next cohort?

@tildeee
Copy link

tildeee commented Dec 1, 2017

TREK

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene x
Comprehension questions x
Functionality
Click a button to list trips x
Click a trip to see trip details x
Fill out a form to reserve a spot x
Errors are reported to the user x
Styling, Foundation grid layout x
Under the Hood
Trip data is retrieved using jQuery AJAX x
JavaScript is well-organized and easy to read x
HTML is semantic x
Overall

For the comp Q on async:
Regarding asynchronous code, anything that runs at some unspecified time in the future is asynchronous, including everything from AJAX success / failure callbacks to button click handlers.

Not sure what the continents array is used for, but because you call trip.continent.toLowerCase(), the code breaks and it stops listing trips after a null continent on some trip.

Overall good job with the project, glad you got to work on adding a new trip

<button type="submitReservation">Add This Trip</button>
</section>
</form>`;
$('#trip-list').prepend(newTripForm);
Copy link

Choose a reason for hiding this comment

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

This particular form doesn't have any HTML that needs to be dynamically generated. Since the form will look the same in all cases, you may consider having this on the html already, and just using jQuery to hide()/show() it when appropriate

response.forEach((trip) => {
const tripInfo = `<li data-id= ${trip.id} id = "trip-${trip.id}"><strong>${trip.name}</strong> - ${trip.weeks} week(s) in ${trip.continent} </li>`;
$('#trip-list ul').append(tripInfo);
if (!continents.includes(trip.continent.toLowerCase()) && trip.continent) {
Copy link

Choose a reason for hiding this comment

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

if trip.continent is null, the code breaks. Surprisingly enough, if you change the order of this conditional, then it'll work:

if (trip.continent && !continents.includes(trip.continent.toLowerCase())) {

In a conditional with an &&, if trip.continent is falsey, it won't bother evaluating the rest of the conditional

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