Skip to content

Alphonso's code review #42

@camelPhonso

Description

@camelPhonso

This might seem like a small win but I'm a sucker for good naming conventions:

function getBooks(user_id) { // camelCase for js function
  return select_books.all(user_id); // snake_case for sql statement
}

Very nice :) the readability of your code at first look went way up with that

The one issue that stood out for me was with organisation of your code base. Did you notice that addBookReview() is never used after being exported from templates.js? Instead, you replicate it's functionality within displayYourBooks()

function displayYourBooks(books) {
  return /*html*/ `
  <div class="Cover">
      <h1>Add a book</h1>
      <form> // shouldn't this form be in it's own template? we're dealing with two concerns here
       ...
      </form>

      
      <ul class="Center Stack">  // the code only does what it says on the tin from this line onward
        ${books
          .map(
            (entry) => `
            <li>
              <h2>${entry.title}</h2>
              <p>${entry.author}</p>
              <p>${entry.review}</p>
              <p>${entry.rating}</p>
            </li>
            `
          )
          .join("")}
      </ul>
      <a href="/log-out" class="Button">Log out</a>
    </div> 
  `;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions