Skip to content

Commit

Permalink
Fixed the single-submission workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kmowery committed Jun 28, 2012
1 parent c3d0273 commit 25e2749
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
23 changes: 13 additions & 10 deletions compare.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,24 @@ def link_to(where, exp, result = nil)
@exp = Experiment.where(:name => experiment).first

# Policy: we store one sample per user-agent and title combination.
@result = Canvas.where(:useragent => env["HTTP_USER_AGENT"],
:experiment_id => @exp.id,
:title => params["title"]).first
@sample = Sample.where(:useragent => env["HTTP_USER_AGENT"],
:userinput => params["title"]).first

if @sample.nil? then
@sample = Sample.create()
@sample.useragent = env["HTTP_USER_AGENT"]
@sample.userinput = params["title"]
@sample.save
end

@result = Canvas.where(:sample_id => @sample.id,
:experiment_id => @exp.id).first

puts "Creating new canvas" if @result.nil?
@result = Canvas.create() if @result.nil?

sample = Sample.new
sample.useragent = env["HTTP_USER_AGENT"]
sample.userinput = params["title"]
sample.save

@result.experiment_id = @exp.id
@result.sample_id = sample.id
@result.title = params["title"]
@result.sample_id = @sample.id
@result.pixels = params["pixels"]
@result.png = params["png"]
@result.save
Expand Down
Binary file modified index.db
Binary file not shown.
4 changes: 4 additions & 0 deletions model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def graphics_card
end

def graphics_card_helper
return "UNKNOWN" if userinput.nil?
return "UNKNOWN" if userinput.length() == 0

device_id = ""
device_id = " (Device #{$1.strip})" if /Device ID\r?\n([^\n]*?)\n/m =~ userinput
device_id = " (Device #{$1.strip})" if /Device ID(.*?)Adapter RAM/m =~ userinput
Expand Down Expand Up @@ -120,6 +123,7 @@ def graphics_card_helper
# Last resort
return "Intel(R) HD Graphics" if /Intel\(R\) HD Graphics/ =~ userinput
return "Intel(R) HD Graphics" if /Inter\(R\) HD Graphics/ =~ userinput
return "UNKNOWN"
end

def title
Expand Down

0 comments on commit 25e2749

Please sign in to comment.