Skip to content

Commit

Permalink
scrubbed install assessment errors
Browse files Browse the repository at this point in the history
  • Loading branch information
devanshk committed May 23, 2018
1 parent a1c475f commit 63a9f86
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions app/controllers/assessments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,11 @@ def new
def installAssessment
ass_dir = Rails.root.join("courses", @course.name)
@unused_config_files = []
flash[:error] = ""
Dir.foreach(ass_dir) do |filename|
# assessment's yaml file must exist
if !File.exist?(File.join(ass_dir, filename, "#{filename}.yml"))
flash[:error] += "Yml does not exist: " + filename +" - "
next
end
next unless File.exist?(File.join(ass_dir, filename, "#{filename}.yml"))

# names must be only lowercase letters and digits
if filename =~ /[^a-z0-9]/
flash[:error] += "Name must be only lowercase letters and digits: "+filename
next
end
next if filename =~ /[^a-z0-9]/

# Only list assessments that aren't installed yet
assessment_exists = @course.assessments.exists?(name: filename)
Expand Down

0 comments on commit 63a9f86

Please sign in to comment.