Skip to content

Commit

Permalink
#177 Use trend index for active-trend command, not trend id. (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
eidekrist authored Jun 3, 2020
1 parent 4863563 commit 69b45fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions libcosim/trending.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ func activeTrend(status *structs.SimulationStatus, trendIndex string) (bool, str
}

func generatePlotData(sim *Simulation, status *structs.SimulationStatus) {
for _, trend := range status.Trends {
if status.ActiveTrend != trend.Id {
for idx, trend := range status.Trends {
if status.ActiveTrend != idx {
for i, _ := range trend.TrendSignals {
trend.TrendSignals[i].TrendXValues = nil
trend.TrendSignals[i].TrendYValues = nil
Expand Down
5 changes: 2 additions & 3 deletions src/client/controller.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,8 @@

(k/reg-event-fx ::trend-enter
(fn [{:keys [db]} [{:keys [index]}]]
(let [trend-id (-> db :state :trends (get (int index)) :id)]
(merge {:db (assoc db :active-trend-index index)}
(socket-command ["active-trend" (str trend-id)])))))
(merge {:db (assoc db :active-trend-index index)}
(socket-command ["active-trend" (str index)]))))

(k/reg-event-fx ::trend-leave
(fn [{:keys [db]} _]
Expand Down

0 comments on commit 69b45fd

Please sign in to comment.