Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4644278
D479.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
711 B
Referenced Files
None
Subscribers
None
D479.diff
View Options
diff --git a/tommy.rb b/tommy.rb
--- a/tommy.rb
+++ b/tommy.rb
@@ -58,20 +58,23 @@
end
helpers do
+ def css_for_score(score)
+ if score == 100
+ 'best'
+ elsif score >= 80
+ 'better'
+ elsif score >= 60
+ 'good'
+ elsif score >= 40
+ 'bad'
+ else
+ 'worse'
+ end
+ end
+
def css_for_project(project)
- score = project.build_score
if project.green?
- if score == 100
- 'best'
- elsif score >= 80
- 'better'
- elsif score >= 60
- 'good'
- elsif score >= 40
- 'bad'
- else
- 'worse'
- end
+ css_for_score(project.build_score)
elsif project.building?
'building'
else
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 25, 00:22 (7 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2435293
Default Alt Text
D479.diff (711 B)
Attached To
Mode
D479: Refactoring: split css_for_project and css_for_score
Attached
Detach File
Event Timeline
Log In to Comment