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

267/display data in classrooms #275

Merged
merged 9 commits into from
Jun 5, 2020
Merged

Conversation

pyphilia
Copy link
Contributor

@pyphilia pyphilia commented Jun 3, 2020

close #267

@pyphilia
Copy link
Contributor Author

pyphilia commented Jun 3, 2020

This PR edit StudentsTable to display the imported data. We can now have spaces as additional columns, and actions and resources icons when they exist.

image

The edition functionalities are also improved to handle the data.
When we want to edit a user, we can delete its related data:

image

When editing a classroom, we can remove spaces (and all their related data):
image

@juancarlosfarah
Copy link
Member

juancarlosfarah commented Jun 4, 2020

@pyphilia, a small comment on the layout of the list of Actions and Resources itself, I think that the delete icon should be on the right. Also, can we use primary colours for icons? Or maybe a grayish one. These black ones are a bit harsh.

Copy link
Member

@juancarlosfarah juancarlosfarah left a comment

Choose a reason for hiding this comment

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

Very nice! Almost wrapped up for release. Just some minor changes.

// update data
const now = new Date();
classroom.assign({ name, updatedAt: now }).write();
classroom.assign({ name, lastUpdatedAt: now }).write();
Copy link
Member

Choose a reason for hiding this comment

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

I believe it should be updatedAt, right? We change it last time from this.

const logger = require('../logger');

// @param deleteSelection : map key-value with space id as key to whether the space data should be deleted
Copy link
Member

Choose a reason for hiding this comment

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

Should be in JSDoc comment format.

name,
deleteSelection,
};
})();
Copy link
Member

Choose a reason for hiding this comment

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

Do you actually need to call the function with the last (); bit? I don't remember it like that in the other classes.

<>
<Typography className={classes.dataTitle}>{t('Spaces')}</Typography>

{spaces.length > 0 ? (
Copy link
Member

Choose a reason for hiding this comment

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

spaces.length no need for > 0


// username cannot be null if actions or resources are imported
if (!username && (appInstanceResources || actions)) {
toastr.error(ERROR_MESSAGE_HEADER, 'A user need to be specified');
Copy link
Member

Choose a reason for hiding this comment

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

needs. Do we factor out and translate?

@@ -0,0 +1,55 @@
export const isClassroomNameValid = name => {
Copy link
Member

Choose a reason for hiding this comment

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

We might want to have simple, but specific unit tests for these functions.

Copy link
Member

@juancarlosfarah juancarlosfarah left a comment

Choose a reason for hiding this comment

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

There is one tiny change I suggest. But then you can go ahead and merge.

return name.trim().length;

// check name is a string
if (typeof name !== 'string' && !(name instanceof String)) {
Copy link
Member

Choose a reason for hiding this comment

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

I would recommend using Lodash. https://lodash.com/docs#isString

@pyphilia pyphilia merged commit bc1c052 into master Jun 5, 2020
@pyphilia pyphilia deleted the 267/displayDataInClassrooms branch June 5, 2020 16:09
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.

Import data in classrooms
2 participants