WeBWorK Main Forum

Assign users (logins in csv) to a set

Re: Assign users (logins in csv) to a set

by Robert Mařík -
Number of replies: 0
Thank you. I finally use the following:

1. From csv extract comma separated logins using something like

for i in `cat ~/Downloads/export.csv | cut -f6 -d,`; do echo $i; done | sort | paste -sd "," | sed 's/"//g'
2. On the webpage where I can add the users by checking checkboxes ( http://SERVER/webwork2/COURSE/instructor/sets2/SET_NAME/users/ ) I run the following code and enter the comma separated logins from the previous step.

str=prompt("Enter logins, comma separated"); 
$.each(logins,function(index,login){$('input[value='+login+']').each(function() { $(this).prop( "checked", true ); }) })

3. Save the changes

Hope this helps to someone else in future.