Use student's user_name as repository name when instructor uses CSV upload file too
Updated 1 year, 8 months ago
| Severin Gehwolf | Reviewers | ||
| trunk | markus_developers | ||
| 537 | |||
| None | MarkUs Source Code Repository | ||
------ Updated May 12, 2010 This review request is only the first part of a lengthy discussion. See reviews http://review.markusproject.org/r/537/ and http://review.markusproject.org/r/538/ for (maybe) an end of this story :-) ------ Original Description To be honest, I didn't consider the CSV upload part at all. Sorry, this has been forgotten. Thinking of it, an implementation (i.e. application of the attached patch) would have the following consequences: RepositoryCollisions might be raised during CSV upload. For instance if an instructor uploads a CSV file in which two different group names exist with the very same student as the only member. I'm handling them, but this might have other consequences, too. Also consider the following scenario: Say A1 is a single person assignment and A2 isn't. If the instructor uses CSV uploads to create the groups for both assignments and uses the very same group_name in the CSV for one or more records, the repository of A1 (named after the user_name of the only student member of the group of A1) will be used, although A2 might be set up to be a group assignment. I.e. we could end up linking to a repository named after a student's user_name, but this repo would be used as a group repository, for another assignment. This is just something to consider. It's probably a very unlikely case.
assignment_test.rb passes. We should add checks for this, though.
Posted 2 years ago (January 12th, 2010, 5:41 p.m.)
Severin: Great work! See notes below, -Mike
-
branches/release_0.6/app/models/assignment.rb (Diff revision 1) -
Maybe I've been staring at the screen too long, but I can't see what's changed here...
-
branches/release_0.6/app/models/assignment.rb (Diff revision 1) -
Hm. I know why we're doing this, but still, silently ignoring exceptions kinda freaks me out a little. Maybe we could have an array of warning messages ("warning - repository collision...")...and maybe some logging here too, in case this gets hairy and we need to do some debugging. What do you think?
Posted 2 years ago (January 12th, 2010, 5:51 p.m.)
-
branches/release_0.6/app/models/assignment.rb (Diff revision 1) -
spaces maybe?
-
branches/release_0.6/app/models/assignment.rb (Diff revision 1) -
messages would be nice for the user to see that he did something that he might have not wanted to and some logging will ease the pain when debugging. This might not be the best solution but since our repository creation is starting to get so flexible that there so many cases to take into account how about create a file with the repository properties, usernames: group or individual: assignments: or something like that ( maybe xml)
Review request changed
Updated 2 years ago (January 29th, 2010, 11:10 p.m.)
-
- added Diff r2
I've updated the csv_upload method in the assignment model to also use the student's username in certain conditions. With this update the permissions problem Karen had recently with one student goes away, too. Permissions have been updated before the memberships were written. Hence, no changes to the svn_authz file were written. I'm afraid, I won't get to test this soon. Apart from that, I'm still struggling how we might automatically test this (repo permissions written to authz and if the student's username is used)... Any ideas welcome!
Posted 2 years ago (January 29th, 2010, 11:12 p.m.)
-
branches/release_0.6/app/controllers/groups_controller.rb (Diff revision 2) -
I won't commit this. It has been remove already from my local changes.
Review request changed
Updated 2 years ago (January 29th, 2010, 11:16 p.m.)
Added a screenshot showing a repository collision.
Posted 2 years ago (February 1st, 2010, 3:29 p.m.)
Severin: Just a few questions / notes below! Nothing major - really close to a ship it, -Mike
-
branches/release_0.6/app/controllers/groups_controller.rb (Diff revision 2) -
Hm. For me, this sort of thing begs for more use of the begin/rescue blocks. And line_nr can be handled by each_with_index. Perhaps: begin FasterCSV.parse(params[:group][:grouplist]).each_with_index do |row, line_nr| @assignment.add_csv_group(row) num_update += 1 rescue CSVLineError => e flash[:invalid_lines] << "Line #{line_nr}: " + e.message rescue Exception => e flash[:error] = "Big, unrecoverable error" raise ActiveRecord::Rollback end And then maybe create some CSVLineError class that extends from Exception to distinguish, and put the logic/messages inside the Assignment.add_csv_group model method. Just an idea to refactor. Doesn't have to be done this time, but maybe write up a ticket for it. -
branches/release_0.6/app/models/assignment.rb (Diff revision 2) -
Can be shortened to: group = Group.find_or_create_by_group_name(row[0])
-
branches/release_0.6/app/models/assignment.rb (Diff revision 2) -
Another good place for refactoring (and a ticket if you don't get to it) - I remember Mike G mentioning that logic like this is often made more readable if turned into a model method, like: self.conditions_perfect_for_student_named_repository(row)
-
branches/release_0.6/app/models/assignment.rb (Diff revision 2) -
Hm...good question. I think regardless, it'd be a good idea to log this.
-
branches/release_0.6/app/models/assignment.rb (Diff revision 2) -
Another spot for refactoring. This is more of a personal thing, but when there's a trivial case like this, I like to put it near the top of the method, and get it out of the way. Again, just a personal thing. :D
-
branches/release_0.6/app/models/assignment.rb (Diff revision 2) -
Question - why are these two lines here, and not after line 298 (grouping.assignment_id = self.id)?
-
branches/release_0.6/app/models/group.rb (Diff revision 2) -
Another question: Is it a safe assumption that if an Instructor has set it up so that, for it's first assignment, commits must be made externally, that all following assignment submission commits will be made externally?
-
branches/release_0.6/app/models/student.rb (Diff revision 2) -
Good catch!
Posted 2 years ago (February 1st, 2010, 5:05 p.m.)
-
branches/release_0.6/app/models/group.rb (Diff revision 2) -
I don't think this is a safe assumption. For instance, Karen uses for her CSC209 class an external commit set-up. But for her labs she wants to allow students to submit via the Web UI. Why are you asking?
Posted 2 years ago (February 1st, 2010, 5:06 p.m.)
-
branches/release_0.6/app/models/assignment.rb (Diff revision 2) -
It's logged in group.rb :-) The whole message including path.
Posted 2 years ago (February 1st, 2010, 5:37 p.m.)
-
branches/release_0.6/app/controllers/groups_controller.rb (Diff revision 2) -
Shall we add an I18n.t() method here ?
-
branches/release_0.6/app/controllers/groups_controller.rb (Diff revision 2) -
Idem there with I18n.t()
-
branches/release_0.6/app/models/assignment.rb (Diff revision 2) -
idem missing I18n.t() ?
Posted 2 years ago (February 1st, 2010, 5:37 p.m.)
-
branches/release_0.6/app/models/group.rb (Diff revision 2) -
What I was trying to do here is to get the assignment this group object belongs to. But this may be a huge bug... Is there a way to find this assignment? At the moment, it doesn't seem obvious to me... :-(
Posted 2 years ago (February 1st, 2010, 6:50 p.m.)
-
branches/release_0.6/app/models/grouping.rb (Diff revision 2) -
I think the Grouping should be responsible for knowing if we write_repo_permissions?, because the Grouping is associated with only one Assignment. So maybe this should be: return unless self.write_repo_permissions? And move write_repo_permissions? into Grouping, which checks markus_config_repository_admin? and self.assignment.allow_web_submits. What do you think? How does that sound?
Review request changed
Updated 1 year, 9 months ago (May 2nd, 2010, 10:08 p.m.)
-
- added Diff r3
I did some refactoring on this and I believe all corner cases are dealt with "OK". There is also a new test suite (in an extra file) using SubversionRepository. It basically looks at what MarkUs creates in the file system. What are your thoughts? BTW: I've thought loudly about the corner cases I could think of here: http://blog.markusproject.org/?p=1535
Posted 1 year, 9 months ago (May 2nd, 2010, 10:08 p.m.)
-
trunk/app/helpers/ensure_config_helper.rb (Diff revision 3) -
I'll remove this, before committing.
Posted 1 year, 9 months ago (May 6th, 2010, 12:36 p.m.)
Has anybody had a chance to look at this yet? Thanks! :-)
Review request changed
Updated 1 year, 9 months ago (May 7th, 2010, 5:58 p.m.)
- changed from branches/release_0.6 to trunk
Switching this to trunk so I can TestDrive.
Posted 1 year, 9 months ago (May 7th, 2010, 7:19 p.m.)
Severin: It looks pretty good - just some minor questions/nitpicks below. Great work! -Mike
-
trunk/app/models/assignment.rb (Diff revision 3) -
Is this method supposed to return anything? I see that it optionally returns collision errors...and it can also return nil. The reason I ask, is because on line 441 of test/unit/assignment_test.rb, we assert @assignment.add_csv_group(group). Asserting isn't going to work if it returns nil. So currently, assignment_test.rb gives off two failing tests. I've noticed this elsewhere too - methods that *sometimes* return things. It's not a problem, but in this case, we either need to change add_csv_group, or update our test.
-
trunk/app/models/assignment.rb (Diff revision 3) -
While you're working in this area, an each loop is the preferred loop in Ruby. start_index_group_members..(row.length - 1).each do |i| ... end
-
trunk/app/models/csv_invalid_line_error.rb (Diff revision 3) -
I'm curious why the new exception class - were we going to add some specialized functions/info to it?
-
trunk/app/views/groups/manage.html.erb (Diff revision 3) -
I18n, while you're here
