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 Cash - Pipes #50

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

Amy Cash - Pipes #50

wants to merge 26 commits into from

Conversation

cashmonger
Copy link

BackTREK

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What role does the Model play in Backbone?
How did the presence of Models and Collections change the way you thought about your app?
How do Backbone Events compare to DOM events?
How did you approach filtering? What was your data flow for this feature?
What do you think of Backbone in comparison to raw JavaScript & jQuery?
Do you have any recommendations on how we could improve this project for the next cohort?

@CheezItMan
Copy link

BackTREK

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Good commit number and good commit messages.
Comprehension questions Check, sorry you had trouble with the project.
Organization
Models and collections are defined in separate files Check
Code that relies on the DOM is located in or called by $(document).ready Check
Code follows the Backbone data flow (DOM event -> update model or collection -> Backbone event -> update DOM)
Functionality
Display list of trips Check
Display trip details Check
Register for a trip Not working, see my in-code comments.
Add a trip NOT WORKING you've got a couple of problem, 1. The new trip doesn't have an ID when you try to add it. See my code notes, you're also not doing validations.
Sort trips Check
General
Snappy visual feedback for user actions It's basic, but works.
API error handling You have the handling, but I'm not able to test it at present since adding doesn't work.
Client-side validation You tried with Trip, but it's not working, see my in-code notes.
Overall This is rough. You have some of the learning goals, but need to work on validations, and handling Backbone Events. Try reviewing some of that in the Ada-Trader project. Let me know if you have questions.


// import Backbone from 'backbone';
//
// const Reservation = Backbone.Model.extend({

Choose a reason for hiding this comment

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

Looks like you were on a good track!

$('th.sort').removeClass('current-sort-field');
$(`th.sort.${ tripList.comparator }` ).addClass('current-sort-field');

tripList.on('update', renderAll);

Choose a reason for hiding this comment

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

These should be in $(document(.ready this will eventually cause lots of rendering when a new model is added or if it's been sorted multiple times.

Only add the listener once, not every time it renders.

const bookTripID = $(event.target).attr('data-id');
let reservationFormData =
$('#reservation-form').serialize();
makeReservation(reservationFormData);

Choose a reason for hiding this comment

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

Here you're calling makeReservation with the wrong paramater. The 1st parameter should be the tripID

}

if (!CONTINENTS.includes(attributes.continent)) {
errors.continent = [' is not a valid continent.'];

Choose a reason for hiding this comment

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

This would overwrite the blank continent message. Instead you'll need to do:

  if (errors.continent) {
   errors.continent.push('is not a valid continent');
  } else {
    errors.continent = [' is not a valid continent.'];
  }


$('#individual-trip').hide();
const newTrip = new Trip(readAddTripForm);
tripList.add(newTrip);

Choose a reason for hiding this comment

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

no checking for validations?

Also the trip doesn't have an ID yet (gets the from the API), so you should wait until the save is successful and then execute tripList.fetch() to pull down the updated Trip from the API (with an ID).

validate: function(attributes) {
const errors = {};
const CONTINENTS = ['Asia', 'Africa', 'Australasia', 'Europe', 'South America', 'North America', 'asia', 'africa', 'australasia', 'europe', 'south america', 'north america']
if (!attributes.name) {

Choose a reason for hiding this comment

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

you'll need this in front of attributes

like:

if (! this.attributes.name) {

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