Skip to content

Conversation

@flash42
Copy link

@flash42 flash42 commented Jun 3, 2019

No description provided.

Copy link
Author

@flash42 flash42 left a comment

Choose a reason for hiding this comment

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

I left a couple of comments inline. The only structure problem I could see (was not checking user facing things) is the one regarding the way you put half-baked elements in the dom and later make lookups to add event listeners to them.

SELECT id, board_id, title, status_id, card_order FROM card;
""")

cards = cursor.fetchall()
Copy link
Author

Choose a reason for hiding this comment

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

Useless variable definition


def get_boards(force=False):
return _get_data('boards', BOARDS_FILE, force)
cards = cursor.fetchall()
Copy link
Author

Choose a reason for hiding this comment

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

Useless variable definition

""")

cards = cursor.fetchall()
print(cards)
Copy link
Author

Choose a reason for hiding this comment

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

printing in production code?

getCardsByBoardId: function (boardId, callback) {
// the cards are retrieved and then the callback function is called with the cards

this._api_get(`/get-cards/${boardId}`, (response) => {
Copy link
Author

Choose a reason for hiding this comment

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

(response) => {} => response => {} // No need for () for a single parameter lambda.

boardContainer.textContent = '';
for (const board of boards) {
const template = document.querySelector('#board-template');
const clone = document.importNode(template.content, true);
Copy link
Author

Choose a reason for hiding this comment

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

What is clone - doesn't tell me what it is. Maybe newBoard, or something it really is.

static/js/dom.js Outdated
${boardList}
</ul>
`;
for (let card of cards) {
Copy link
Author

Choose a reason for hiding this comment

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

Sometimes there is const, here it is let in the for-each loop. Please use it consistently. Const is preferred over let, if you don't want (here you don't) to overwrite it.

}
},
addNewBoard: function () {
let addBoardButton = document.querySelector("#add-new-board-btn");
Copy link
Author

Choose a reason for hiding this comment

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

You can use const

})
},
showNewBoard: function (response) {
let boardContainer = document.querySelector('.board-container');
Copy link
Author

Choose a reason for hiding this comment

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

You can use const

loadCards: function (boardId) {
// retrieves cards and makes showCards called
addNewCard: function (boardId) {
let addNewCardButtons = document.querySelectorAll(".board-add");
Copy link
Author

Choose a reason for hiding this comment

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

o_O This is hard to follow form the code. Why we need to look up these addNewCardButtons? More interesting question is why do we have board-add class on them? Can we not create the button with the proper event listener before we add it to the dom?

Copy link
Author

Choose a reason for hiding this comment

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

Ask if something is not clear :)


if (parseInt(response.board_id) === parseInt(column.dataset.boardId) &&
parseInt(response.status_id) === parseInt(column.id)) {
const template = document.querySelector('#cards-template');
Copy link
Author

Choose a reason for hiding this comment

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

There is a lot of string literals scattered across the code. Can you please extract them to methods?
e.g.:

const template = document.querySelector('#cards-template') => 
getCardsTemplate(): function() {
 return  document.querySelector('#cards-template').content;
}
const newCard = document.importNode(getCardsTemplate(), true); 

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.

5 participants