Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Moves RosterEntry update to background job #2233

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

shaunakpp
Copy link
Contributor

@shaunakpp shaunakpp commented Aug 12, 2019

What

Fixes #2210

  • Setup AddStudentsToRosterChannel to send progress
  • channel is called from AddStudentsToRosterJob
  • progress via action cable is handled by add_students_to_roster.js
  • removes the old create_entries method from model

TODO:

  • Add specs
  • Iterate on UIUX

UI: update with a few students(< 100)
fast_update

UI: update with many students(> 100)
slow_update

- Setup AddStudentsToRosterChannel to send progress
- channel is called from AddStudentsToRosterJob
- progress via action cable is handled by add_students_to_roster.js
- removes the old method from model
@d12
Copy link
Contributor

d12 commented Aug 12, 2019

Curious how large of a CSV would need to be uploaded to see delays. RosterEntry's are very lightweight AR objects, so I'm surprised we're noticing any issues here.

@shaunakpp
Copy link
Contributor Author

I agree, we don't see any noticeable delays with 15-20 objects, but I did notice delays with around 100 entries. Also, since everything is in a transaction if the teacher cancels, we do a rollback which takes significant time, especially with large number of students.

In most cases(adding a few students), teachers wouldn't even notice the progress bar, but It can be useful if a large CSV is uploaded.

@shaunakpp shaunakpp changed the title Moves RosterEntry creation to background job Moves RosterEntry update to background job Aug 15, 2019
@shaunakpp shaunakpp marked this pull request as ready for review August 19, 2019 18:01
@shaunakpp shaunakpp requested a review from a team as a code owner August 19, 2019 18:01
@shaunakpp
Copy link
Contributor Author

shaunakpp commented Aug 19, 2019

cc: @femmebot I've added a progress bar for the update, but I'm not fully confident about how it looks, or it's placement. I'd love your inputs on how we could add it to this page.

Personally, I think I could improve on:

  • Adding a flash message to describe that the update is in progress(already working on it)
  • Displaying information about the identifiers which were not added
  • Moving this to the modal itself?
  • If we move to a modal, display a message to teacher that the update is in progress, if the page refreshes and/or when the modal is not displayed.

@femmebot
Copy link
Contributor

One quick suggestion: In the tabs, could we add the total count of all students and unlinked students. It's one quick way teachers can confirm whether they have all students accounted for.

@shaunakpp
Copy link
Contributor Author

shaunakpp commented Aug 19, 2019

One quick suggestion: In the tabs, could we add the total count of all students and unlinked students. It's one quick way teachers can confirm whether they have all students accounted for.

Added this change:

Screen Shot 2019-08-19 at 2 49 04 PM

@stephaniegiang
Copy link
Contributor

@d12 This job is actually great especially with duplicate roster entries. With bigger classes, doing those duplicate checks will take a really long time.

@shaunakpp shaunakpp mentioned this pull request Aug 20, 2019
7 tasks
Copy link
Contributor

@stephaniegiang stephaniegiang left a comment

Choose a reason for hiding this comment

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

Love this ❤️

But maybe we can get one more approval from @femmebot?

@femmebot
Copy link
Contributor

femmebot commented Sep 3, 2019

I think I'm confused by the existing UI 😂(perhaps not directly from this PR). If there are only 3 unlinked GitHub accounts in the Unlinked GitHub accounts, why do all the students in the All students say "unlinked user"

@stephaniegiang
Copy link
Contributor

@femmebot Could you do a screenshot? Not sure if I'm seeing this

@femmebot
Copy link
Contributor

femmebot commented Sep 4, 2019

@femmebot Could you do a screenshot? Not sure if I'm seeing this

ah, I was referring to the gif shown here

@stephaniegiang
Copy link
Contributor

Ohhh 🤦‍♀ That is because the roster entries are not linked to a GitHub user yet. But we want to display all the roster entries. Maybe we can change this in the future? Maybe rename the tab or something?

@femmebot
Copy link
Contributor

femmebot commented Sep 4, 2019

Wait … so the users in Unlinked GitHub accounts is not the same as unlinked user? Also, is the teacher expected to manually link all the students shortly after they add the roster?

@stephaniegiang
Copy link
Contributor

Yea they are not the same. Teachers could manually link all the students to the roster, but they usually don't. When a student accepts an assignment, they are presented with the screen to click their roster identifier. That is how most roster entries get linked to a GitHub account.

app/controllers/orgs/rosters_controller.rb Outdated Show resolved Hide resolved
app/controllers/orgs/rosters_controller.rb Outdated Show resolved Hide resolved

redirect_to roster_path(current_organization)
identifiers = params[:identifiers].split("\r\n").reject(&:blank?)
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking: this split is the same as before but it feels odd that we are splitting on \r\n I would have expected only \n and then a trim on the identifiers.

app/jobs/add_students_to_roster_job.rb Outdated Show resolved Hide resolved
@shaunakpp
Copy link
Contributor Author

Hi @jeffrafter it looks like I can't accept the change because of permissions, so @stephaniegiang can you help me out?

@stephaniegiang
Copy link
Contributor

@shaunakpp accepted the changes. Let me know if you need more help 😄

@shaunakpp
Copy link
Contributor Author

shaunakpp commented Oct 17, 2019

I've resolved the conflicts in #2402 as I cannot directly resolve conflicts in this branch. We can merge #2402 directly as it is updating this branch and does not affect master

@stephaniegiang
Copy link
Contributor

@shaunakpp sounds like a good plan! Are you able to do this yourself?

@shaunakpp
Copy link
Contributor Author

@stephaniegiang yup, conflicts are resolved and all specs pass, you'll just need to merge #2402 😅

Keep roster-add-active-job in sync with master.
@stephaniegiang
Copy link
Contributor

@shaunakpp Done 😄I'll do another round of testing on this PR before we merge

@shaunakpp
Copy link
Contributor Author

@stephaniegiang thank you so much! ❤️

@stephaniegiang
Copy link
Contributor

Looks really good 😄 Just tested it and ran smoothly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move adding students in a Roster to a background job
5 participants