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
E1829. OSS project Duke Blue: Fix import glitches [use new issue list] #1267
Conversation
Generated by expertiza-bot |
Hey @ppvasude, TravisCI finished with status TravisBuddy Request Identifier: 77f607a0-dc5a-11e8-a919-2b33139089d4 |
Pull Request Test Coverage Report for Build 5968
💛 - Coveralls |
team.update(name:self.generate_team_name(Assignment.find(id).name)) # update the old team name | ||
end | ||
#team.update(name:self.generate_team_name(Assignment.find(id).name)) | ||
return name # send the new team name |
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.
Avoid too many return
statements within this method.
if teamtype.is_a?(CourseTeam) | ||
team.update(name:self.generate_team_name(Course.find(id).name)) # update the old team name | ||
elsif teamtype.is_a?(AssignmentTeam) | ||
team.update(name:self.generate_team_name(Assignment.find(id).name)) # update the old team name |
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.
Space missing after colon.
puts name.to_s #team name | ||
|
||
|
||
|
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.
Extra blank line detected.
|
||
|
||
|
||
|
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.
Extra blank line detected.
@@ -203,6 +204,13 @@ def self.import(row_hash, id, options, teamtype) | |||
|
|||
# Handle existence of the duplicate team | |||
def self.handle_duplicate(team, name, id, handle_dups, teamtype) | |||
puts "in duplicate" | |||
puts team.to_s # team object | |||
puts name.to_s #team name |
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.
Missing space after #
.
@@ -152,7 +152,7 @@ def self.generate_team_name(team_name_prefix) | |||
counter = 1 | |||
loop do | |||
team_name = team_name_prefix + "_Team#{counter}" | |||
return team_name unless Team.find_by(name: team_name) | |||
return team_name unless !Team.find_by(name: team_name).nil? |
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.
Favor if
over unless
for negative conditions.
@@ -178,6 +178,7 @@ def import_team_members(starting_index = 0, row_hash) | |||
def self.import(row_hash, id, options, teamtype) | |||
|
|||
raise ArgumentError, "Not enough fields on this line." if row_hash.empty? || (row_hash[:teammembers].length < 2 && (options[:has_teamname] == "true_first" || options[:has_teamname] == "true_last")) || (row_hash[:teammembers].empty? && (options[:has_teamname] == "true_first" || options[:has_teamname] == "true_last")) | |||
puts "hi, im in import" |
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 not write to stdout. Use Rails's logger if you want to log.
@@ -203,6 +204,13 @@ def self.import(row_hash, id, options, teamtype) | |||
|
|||
# Handle existence of the duplicate team | |||
def self.handle_duplicate(team, name, id, handle_dups, teamtype) | |||
puts "in duplicate" |
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 not write to stdout. Use Rails's logger if you want to log.
@@ -203,6 +204,13 @@ def self.import(row_hash, id, options, teamtype) | |||
|
|||
# Handle existence of the duplicate team | |||
def self.handle_duplicate(team, name, id, handle_dups, teamtype) | |||
puts "in duplicate" | |||
puts team.to_s # team object |
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 not write to stdout. Use Rails's logger if you want to log.
@@ -203,6 +204,13 @@ def self.import(row_hash, id, options, teamtype) | |||
|
|||
# Handle existence of the duplicate team | |||
def self.handle_duplicate(team, name, id, handle_dups, teamtype) | |||
puts "in duplicate" | |||
puts team.to_s # team object | |||
puts name.to_s #team name |
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 not write to stdout. Use Rails's logger if you want to log.
Code Climate has analyzed commit c4468b2 and detected 16 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 38.4% (50% is the threshold). This pull request will bring the total coverage in the repository to 47.6% (0.0% change). View more on Code Climate. |
We have added a new option in the dropdown in app/views/import_file/start.html.erb for renaming exisiting team name if new team has same name as existing team. We have made changes team.rb to rename existing team using the generate name function already present. We then save these updated changes of the existing team.