-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
Correct the problem numbers when a set definition file is imported. #2254
Correct the problem numbers when a set definition file is imported. #2254
Conversation
9267829
to
962ece0
Compare
Also note that if you shift the problem numbers as you suggest, then you are honoring the order the instructor set, but not the original problem ids that the instructor set. So you still are not disobeying the intent of the instructor, and really there is no way to do so in this case. |
By the way, when an invalid problem id is found in the set definition file, then the problem id is set to the empty string. So if a set definition file has the problem ids |
I agree no way to preserve the complete intent, to me when I design a set problem order is more important than the actual number assigned to the problem, hence why I suggested a shift, as moving the problem out of order would be more disruptive to me. Seems there is already code in place to deal with invalid problem IDs, maybe 0 should just be added to that ? What happens to the empty problem ids when added to the database? |
Oh wait, looking at the actual pull request, I see that you are just adding 0 to the previous method of dealing with invalid problem IDs, that is probably best for now. |
Yes, this just fixes the handling of invalid problem ids with the same behavior it had before. This doesn't technically add |
Currently the problem numbers in the set defintion file are completely ignored due to a minor mistake. `problem_id` is used in the set definition file, and `problemID` is used by the `WeBWorK::Utils::Instructor::addProblemToSet` method, and I made didn't translate that correctly.
This identifies the maximum valid problem id, and then invalid problem ids that are found use one more than that. Of course the max is incremented for later invalid problem ids. This is the simplest approach. So this gives the following numberings: set def -> result `0,1,2,3` -> `1,2,3,4` `0,2,3,4` -> `2,3,4,5` `0,1,2,5` -> `1,2,5,6` Another option that could be implemented is to fill when gaps in the valid numbers are found. That takes a bit more work, but could be done.
962ece0
to
fa9ea06
Compare
Currently the problem numbers in the set defintion file are completely ignored due to a minor mistake.
problem_id
is used in the set definition file, andproblemID
is used by theWeBWorK::Utils::Instructor::addProblemToSet
method, and I made didn't translate that correctly.This fixes the issue noted by @Alex-Jordan in #2194 (comment).
Note that this does not fix the issue noted in the next comment there (#2194 (comment)). I tested that on both WeBWorK 2.17, 2.18, and with this pull request, and all have that issue. With the current develop branch without this pull request this issue does not occur because of the error in translation fixed in this pull request which basically results in a set definition import always having problems numbered consecutively starting at 1. I know why the issue occurs, and will look into finding a fix and submit another pull request for that.
Edit: Now this does fix the issue noted above with the simplest possible approach of using the max of the valid problem ids from the set definition file plus 1 (and incrementing from there).