Skip to content

Commit a096d57

Browse files
author
Ben Lerner
committed
don't always try to get tap
1 parent 3e16c41 commit a096d57

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

app/models/grade.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def full_log
4040

4141
def can_compare_orca_tap?
4242
return false unless has_orca_output?
43+
return false unless grading_output_path.ends_with? ".tap"
44+
return false unless orca_output_path.ends_with? ".tap"
45+
4346
!(self.bottlenose_tap.nil? || orca_output['output'].nil?)
4447
end
4548

@@ -93,7 +96,13 @@ def has_orca_output?
9396

9497
def orca_output
9598
return nil unless has_orca_output?
96-
JSON.parse(File.open(orca_result_path).read)
99+
if orca_result_path.ends_with? ".json"
100+
JSON.parse(File.open(orca_result_path).read)
101+
elsif orca_result_path.ends_with? ".tap"
102+
TapParser.new(File.read(orca_result_path))
103+
else
104+
File.read(orca_result_path)
105+
end
97106
end
98107

99108
def orca_result_path
@@ -131,12 +140,12 @@ def tap_test_counts_match?
131140
def orca_tap
132141
return nil if orca_output.nil? || orca_output['output'].nil?
133142

134-
TapParser.new(orca_output['output'])
143+
TapParser.new(orca_output['output']) rescue false
135144
end
136145

137146
def bottlenose_tap
138147
return nil if self.grading_output.nil?
139148

140-
TapParser.new(File.read(self.grading_output_path))
149+
TapParser.new(File.read(self.grading_output_path)) rescue false
141150
end
142151
end

0 commit comments

Comments
 (0)