Skip to content

Move students: hook up new component, remove old code#22208

Merged
maddiedierker merged 20 commits into
stagingfrom
move-students-pt5
May 7, 2018
Merged

Move students: hook up new component, remove old code#22208
maddiedierker merged 20 commits into
stagingfrom
move-students-pt5

Conversation

@maddiedierker

@maddiedierker maddiedierker commented May 4, 2018

Copy link
Copy Markdown
Contributor

This PR is the last in a series to convert 'move students' from Angular to React. See my previous PR or the spec for context.

What does this code do?

  • updates/tweaks styling
  • updates tests/storybook
  • makes 'move students' table sort alphabetically by student name on dialog open (picture below)
  • adds success notifications to parent component (more info + pictures below)
  • removes old code
  • updates /sections/transfers endpoint. specifically, the angular implementation was sending the stay_enrolled_in_current_section and student_ids params as stringified boolean and array of integers, respectively. the new implementation sends a JSON request with boolean/[int].

Examples

Manage Students tab

Routing to the 'manage students' tab, you should now see the new 'move students' button:
screen shot 2018-05-04 at 2 35 40 pm

Default alphabetical student sorting

On opening the dialog, the students in the dialog table should be sorted alphabetically by name:
screen shot 2018-05-04 at 2 05 37 pm

Success Notifications

When students are successfully transferred to a different section, the dialog should close and the ManageStudentsTable component (parent of MoveStudents) will render a notification. This notification should be different based on whether the students were moved (and subsequently removed from the current section) or copied to the new section.

If students were moved to new section:
screen shot 2018-05-04 at 2 18 23 pm

If students were copied to new section:
screen shot 2018-05-04 at 2 34 16 pm

@maddiedierker maddiedierker changed the title Move students: hook up new component, remove old code [WIP, please don't merge] Move students: hook up new component, remove old code May 4, 2018
@maddiedierker maddiedierker changed the title [WIP, please don't merge] Move students: hook up new component, remove old code Move students: hook up new component, remove old code May 4, 2018
return false;
}
};
}]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

threw_it_on_the_ground

const nameCells = wrapper.find('.uitest-name-cell');
expect(nameCells.at(0).text()).to.equal('studentc');
expect(nameCells.at(1).text()).to.equal('studentb');
expect(nameCells.at(2).text()).to.equal('studenta');

@islemaster islemaster May 4, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We're also using chai-enzyme which enables enzyme-specific assertions like:

expect(nameCells.at(0)).to.have.text('studentc');
expect(nameCells.at(1)).to.have.text('studentb');
expect(nameCells.at(2)).to.have.text('studenta');

@islemaster islemaster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hooray for tearing out old code!

I'll check again after the updates to transfers_controller_test.rb.

@maddiedierker

Copy link
Copy Markdown
Contributor Author

@islemaster thanks for the feedback! the transfers_controller tests should be good to go now 😃

isMoveStudentsEnabled = () => {
const {loginType} = this.props;
return loginType === SectionLoginType.word || loginType === SectionLoginType.picture || loginType === SectionLoginType.email;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, one more thing: Can we add a test to ManageStudentsTableTest asserting this behavior? (Or maybe its inverse - we don't show a move students button for Google or Clever sections.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

for sure, that's a good call 👍

@islemaster islemaster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hypno-sloth

@maddiedierker maddiedierker merged commit 3412b93 into staging May 7, 2018
@maddiedierker maddiedierker deleted the move-students-pt5 branch May 7, 2018 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants