diff options
| author | mo khan <mo@mokhan.ca> | 2016-06-25 22:57:05 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2016-06-25 22:57:05 -0600 |
| commit | 4a6be5c03daf44cd1904ef092f2fe62802f16f31 (patch) | |
| tree | 8316cf4a4d3651826725c173749b740126143582 /app/assets/javascripts | |
| parent | c65636d24a5d3932fcd57bc9df7673032927a024 (diff) | |
use reduce instead of each.
Diffstat (limited to 'app/assets/javascripts')
| -rw-r--r-- | app/assets/javascripts/views/workout_view.js.coffee | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/assets/javascripts/views/workout_view.js.coffee b/app/assets/javascripts/views/workout_view.js.coffee index 56c64a4..a8f4f81 100644 --- a/app/assets/javascripts/views/workout_view.js.coffee +++ b/app/assets/javascripts/views/workout_view.js.coffee @@ -7,10 +7,10 @@ class Stronglifters.WorkoutView extends Ractive @on 'updateProgress', (event) -> model = new Stronglifters.Set(@get(event.keypath)) @updateProgress(model) - x = {} - _.each _.keys(model.changed), (key) -> + prefix = (x, key) -> x["#{event.keypath}.#{key}"] = model.changed[key] - @set(x) + x + @set(_.reduce(_.keys(model.changed), prefix, {})) @observe 'workout.exercises.*.sets.*', (newValue, oldValue, keypath) -> @refreshStatus(newValue, oldValue, keypath) |
