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

Copy set level proctors when adding a course and copying sets. #2672

Merged

Conversation

drgrice1
Copy link
Member

If sets are copied then everything for that set should be copied. These set level proctor users belong to the set.

This fixes issue #2652.

Also add a missing maketext call in the related template.

Also fix some database list/get usage that I missed when these copy options were implemented. Never list all database records if you are going to subsequently get all records anyway. Listing records is the equivalent of calling SELECT id from table and getting all records is the equivalent of calling SELECT * from table. Why would you inneficiently first list to get id's and then select everything separately? Note that you can get always get all records by using the webwork2 db Where methods with no where clause.

Note that the copying of sets that is done here is still highly inneficient. The current approach gets all sets, and then loops through those sets, then gets the problems for that set and loops through those adding one at a time, then gets set locations and loops through adding one of those at a time, and now adds the set level proctor (of which there can be only one). Instead since all sets are being copyied all sets could be fetched and added at once, then all problems for all sets fetched and added at once, then all set level proctors for all sets fetched and added at once. However, adding all at once like that takes for effort because there aren't convenience database methods for doing that. This is now done when assigning sets to multiple users (I helped @taniwallach implement that) and the same could be done here. Note that for a course with a large number of sets and a lot of problems the current approach is quite slow.

@drgrice1 drgrice1 force-pushed the copy-set-level-proctors-with-sets branch 2 times, most recently from e7713e8 to d9e3038 Compare February 14, 2025 02:42
If sets are copied then everything for that set should be copied.  These
set level proctor users belong to the set.

This fixes issue openwebwork#2652.

Also add a missing `maketext` call in the related template.

Also fix some database list/get usage that I missed when these copy
options were implemented.  Never list all database records if you are
going to subsequently get all records anyway.  Listing records is the
equivalent of calling `SELECT id from table` and getting all records is
the equivalent of calling `SELECT * from table`.  Why would you
inneficiently first list to get id's and then select everything
separately?  Note that you can get always get all records by using the
webwork2 db `Where` methods with no where clause.

Note that the copying of sets that is done here is still highly
inneficient.  The current approach gets all sets, and then loops through
those sets, then gets the problems for that set and loops through those
adding one at a time, then gets set locations and loops through adding
one of those at a time, and now adds the set level proctor (of which
there can be only one).  Instead since all sets are being copyied all
sets could be fetched and added at once, then all problems for all sets
fetched and added at once, then all set level proctors for all sets
fetched and added at once.  However, adding all at once like that takes
for effort because there aren't convenience database methods for doing
that.  This is now done when assigning sets to multiple users (I helped
@taniwallach implement that) and the same could be done here.  Note that
for a course with a large number of sets and a lot of problems the
current approach is quite slow.
@drgrice1 drgrice1 force-pushed the copy-set-level-proctors-with-sets branch from d9e3038 to fc7f210 Compare February 14, 2025 02:43
Copy link
Contributor

@somiaj somiaj left a comment

Choose a reason for hiding this comment

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

Tested the issue is fixed and set proctors are copied.

@somiaj somiaj merged commit ab56984 into openwebwork:develop Feb 18, 2025
2 checks passed
@drgrice1 drgrice1 deleted the copy-set-level-proctors-with-sets branch February 18, 2025 01:54
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.

3 participants