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

PADV-961 feat: Add instructor assignment section #31

Merged
merged 1 commit into from
Jan 26, 2024
Merged

Conversation

AuraAlba
Copy link
Contributor

Ticket

https://agile-jira.pearson.com/browse/PADV-961

Description

Add instructor assignment section

Changes made

Add instructor assignment section
Move getClassesByInstitution to common folder
Replace moment for date-fns required for the calendar component
Update tests
Define renderWithProviders for redux test to avoid import of provider in every test

Screenshots

Screenshot from 2024-01-25 18-41-32

How to test

Clone the Institution Portal MFE
Run npm install.
Run npm run start
Go to http://localhost:1980/dashboard

@@ -51,7 +55,30 @@ describe('Common api services', () => {

expect(httpClientMock.get).toHaveBeenCalledTimes(1);
expect(httpClientMock.get).toHaveBeenCalledWith(
'http://localhost:18000/pearson_course_operation/api/v2/license-pool/?limit=true&institution_id=1',
'http://localhost:18000/pearson_course_operation/api/v2/license-pool/'
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this is working now? @AuraAlba

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this file in the list of eslintignore so this line is not necessary

}, [idInstitution]); // eslint-disable-line react-hooks/exhaustive-deps

useEffect(() => {
// Show in home only two first classes
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Show in home only two first classes
// Display only the first 'NumberOfClasses' on the homepage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why number of classes? in the home page will display the two first classes without instructor assign

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it, is a variable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


useEffect(() => {
// Show in home only two first classes
if (classesData.length > 2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think set the number 2 as a variable? @AuraAlba

Suggested change
if (classesData.length > 2) {
if (classesData.length > NumberOfClasses) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

useEffect(() => {
// Show in home only two first classes
if (classesData.length > 2) {
setClassCards(classesData.slice(0, 2));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
setClassCards(classesData.slice(0, 2));
setClassCards(classesData.slice(0, NumberOfClasses));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

<Col xs="12">
<h4 className="title-instr-assign">Instructor assignment</h4>
{classCards.map(classInfo => <ClassCard data={classInfo} />)}
{classesData.length > 2 && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{classesData.length > 2 && (
{classesData.length > NumberOfClasses && (

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

preloadedState = {},
// Automatically create a store instance if no store was passed in
store = initializeStore(preloadedState),
...renderOptions
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
...renderOptions
...renderOptions,

Trailing comma.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change makes failed redux test: Unexpected trailing comma after rest element. So I won't add it

@AuraAlba AuraAlba merged commit 31c924a into master Jan 26, 2024
2 checks passed
@AuraAlba AuraAlba deleted the vue/PADV-961 branch January 26, 2024 16:14
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