We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8065993 commit 6af1063Copy full SHA for 6af1063
lib/esdb/match.rb
@@ -3,5 +3,24 @@ class Match < ESDB::Resource
3
def duration_minutes
4
return (duration_seconds / 60.0).round
5
end
6
+
7
+ # where does this function belong?
8
+ #
9
+ # MR says "[if it] deals directly with data on the model, it goes in the model"
10
11
+ # and yet this feels suspiciously like view logic.
12
13
+ def chart_data(measure)
14
+ entities.collect {|entity|
15
+ extracted_measures = []
16
+ entity["minutes"].each {|minute, measures|
17
+ extracted_measures[minute.to_i] = measures[measure].to_f
18
+ }
19
+ {:name => entity["identity"]["name"],
20
+ :data => extracted_measures,
21
+ :color => "#" + entity["color"],
22
23
+ }.to_json
24
+ end
25
26
0 commit comments