-
Notifications
You must be signed in to change notification settings - Fork 31
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
[#3107]Implement script for splitting assignments between surveys. #3121
[#3107]Implement script for splitting assignments between surveys. #3121
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a general comment, I was just thinking that maybe its going to be saving the constant pinging to the backend if you retrieve all the SurveyGroup and Survey entities before starting with the splitting up. That way you have all the relationships, names etc upfront rather than pinging the datastore from within a for loop. that usually slows things down.
System.out.println("Splitting assignment " + id + " into " + surveys.size()); | ||
|
||
int part = 0; | ||
for (List<Long> f: surveys.values()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (List<Long> f: surveys.values()) { | |
for (List<Long> formsList: surveys.values()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually never thought the assignments were numerous enough to deserve optimisation...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reused those methods from another datascript, to save time and testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True there are probably not that many. (400 on some of the larger instances). it still makes the communication with the datastore very chatty which is considered an anti-pattern for datastore access at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done. I still think reimplementing it took longer that running it would have...
if (++part == 1) { //change it | ||
toBeSaved.add(ass); | ||
System.out.println(" changing from " + ass); | ||
ass.setProperty("name", name + " [" + part + "]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think its an idea to have the part
use partially or fully the survey name? That may be clearer than just having a number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Before the PR (what is the issue or what needed to be done)
Assignments must not contain forms from different surveys.
The solution
Datascript to split them.
Screenshots (if appropriate)
Checklist