CSC/ECE 517 Fall 2019 - E1938. OSS project Duke Blue: Fix import glitches: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 40: Line 40:
<br>
<br>
After fixing changes<br>
After fixing changes<br>
[[Media:Insert_new_in_old.PNG]]
[[File:Insert_new_in_old.PNG]]
<br>
<br>
In team.rb<br>
In team.rb<br>
     # E1938: Added handling for renaming old team when conflict arises
     # E1938: Added handling for renaming old team when conflict arises

Revision as of 20:26, 28 October 2019

Issue #918

New code introduced is as follows.
File:app/helpers/import_topics_helper.rb
Code: def self.define_attributes(row_hash)

   attributes = {}
   if !row_hash[:description].nil? and !row_hash[:description].ascii_only?
     row_hash[:description] = self.trim_non_ascii(row_hash[:description])
     puts row_hash[:description]
   end
   attributes["topic_identifier"] = row_hash[:topic_identifier].strip
   attributes["topic_name"] = row_hash[:topic_name].strip
   attributes["max_choosers"] = row_hash[:max_choosers].strip
   attributes
 end
 def self.trim_non_ascii(string)
   string.split().each do |char|
     !char.ascii_only? ? string.tr!(char, ' ') : nil
   end
   string.gsub!(/\s+/, ' ')
 end

Issue #328

This was an issue to fix the functionality of Insert any new members into existing team. This was due to faulty handling of the option handle_dups and incorrect checking of parameters.
Code was modified to ensure minimal impact to existing testcases and functionalities. Code:

     name = handle_duplicate(team, name, id, options["handle_dups"], teamtype)

Issue #329

This was a request to add an option to rename existing team if there was a conflict in the team name.
New code introduced was as follows:
In start.html.erb

         <option value="rename_existing">rename the existing team and import</option>



After fixing changes


In team.rb

   # E1938: Added handling for renaming old team when conflict arises
   if handle_dups == "rename_existing"
     if teamtype.is_a?(CourseTeam.class)
       team.update(name: self.generate_team_name(Course.find(id).name))
     elsif  teamtype.is_a?(AssignmentTeam.class)
       team.update(name: self.generate_team_name(Assignment.find(id).name))
     end
     return name
   end