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.

Added some comments inline

users.append(user_data)
else:
users = [user_data]
print(users)
Copy link
Author

Choose a reason for hiding this comment

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

print in production code?

},
getBoards: function (callback) {
// the boards are retrieved and then the callback function is called with the boards
if(this._data.hasOwnProperty('boards')){
Copy link
Author

Choose a reason for hiding this comment

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

whitespace 🚔

let template = document.querySelector('#board_header');
let clone = document.importNode(template.content, true);
let section = document.createElement(`section`);
section.id = `board${board.id}`;
Copy link
Author

Choose a reason for hiding this comment

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

It is not a best practice to put ids on everything in the dom. Why do you need it at all?

for (let board of boards) {
if ((board['userid'] === '0' && !board['userid']) || board['userid'] === userid) {
let template = document.querySelector('#board_header');
let 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.

Clone is a very vague term. Please use something which is more intentional. It is not easy to understand what it really is. You put it in a section, where the section had a board class. 😕

// shows the cards of a board
// it adds necessary event listeners also
const board = document.querySelector(`#board${boardId}`);
let template_column = document.querySelector('#board_columns');
Copy link
Author

Choose a reason for hiding this comment

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

Please use camelCase variable names: templateColumn

let clone_columns = document.importNode(template_column.content, true);
clone_columns.querySelector('.board-columns').id = `box${boardId}`;
for (let card of cards) {
let card_template = document.querySelector('#card_sample');
Copy link
Author

Choose a reason for hiding this comment

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

Creating a new card could be extracted to a function, e.g. createCard.

});
},
showLoggedIn: function () {
let username = sessionStorage.getItem("username");
Copy link
Author

Choose a reason for hiding this comment

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

I'd suggest using const for variables you don't want to redefine.

},

logout: function () {
if (sessionStorage.getItem("username"))
Copy link
Author

Choose a reason for hiding this comment

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

You don't need to check that getItem gives back a truthy value, you can go ahead and removeItem



def get_max_id(data):
print(len(data))
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?

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.

6 participants