Skip to content

Conversation

@nbrandolini
Copy link

TREK

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What does it mean for code to be asynchronous? It means that the code will go into the next line while it's processing the first line of code or while API calls are made.
Describe a piece of your code that executes asynchronously. How did this affect the way you structured it? In my code the functions are executed by clicking a button. When clicking on "See all trips" a message comes up that "trips are loading" but it doesn't stop the request to the API. I also used .then and .catch to manage the responses.
What kind of errors might the API give you? How did you choose to handle them? I have a function that handles status messages returned by the API. The errors are network error, invalid query.
Do you have any recommendations on how we could improve this project for the next cohort? I liked the project even though I got stocked at the reservation part.

let userData = {
'name': $('input[name="user-name"]').val(),
'email': $('input[name="email"]').val(),
};
Copy link

Choose a reason for hiding this comment

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

Since this is JavaScript, all property names (keys) are assumed to be strings, so you can write this as:

  let userData = {
    name: $('input[name="user-name"]').val(),
    email: $('input[name="email"]').val(),
  };

//RESERVE TRIP

const reserveTrip = (id) => {
reportStatus('');
Copy link

Choose a reason for hiding this comment

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

Do you need this?

<input type="text" name="email" />
</div>
<div class="submit-container">
<input type="submit" name="add-reservation" value="Reserve" class="reserve" id="reserve${response.data.id}"/>
Copy link

Choose a reason for hiding this comment

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

Out of curiosity, why do you make the id="reserve..."? Why not just id="${response.data.id}"? Because of this you need to add the .substr(7) part on line 105

// ACTION
$(document).ready(() => {
$('#load').click(loadTrips);
$('#tbody').on('click', 'tr', function () {
Copy link

Choose a reason for hiding this comment

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

something with the ID tbody doesn't make much sense 😆 because tbody doesn't help me understand what is unique about it, and IDs are to help me know what the unique identifier is. Also, it's on an element tbody

tripsList.empty();

reportStatus('Loading trips! Please wait...');
$('#table').show();
Copy link

Choose a reason for hiding this comment

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

same comment as below, but: the ID #table isn't a very helpful ID name! Which table is it?

@tildeee
Copy link

tildeee commented Jun 1, 2018

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 x, nice use of Foundation
Under the Hood
Trip data is retrieved using from the API x
JavaScript is well-organized and easy to read yes, but the indentation is so off!
HTML is semantic mostly... ID names were sometimes strange, but overall good
Overall

One huge thing: your indentation is totally off!

That being said... Good job with this project! It does everything correctly.

I added a few comments, but otherwise good work

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