Skip to content

Commit

Permalink
bugfix cannot add a new KPI to dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca authored and metas-ts committed Jun 23, 2017
1 parent 59301ff commit 2231c59
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ public JSONDashboardItem addKPIItem(@RequestBody final JsonUserDashboardItemAddR
{
userSession.assertLoggedIn();

final UserDashboard userDashboard = getUserDashboardForWriting();
final int itemId = userDashboardRepo.addUserDashboardItem(userDashboard, DashboardWidgetType.KPI, request);
final int itemId = userDashboardRepo.addUserDashboardItem(getUserDashboardForWriting(), DashboardWidgetType.KPI, request);

final UserDashboardItem kpiItem = userDashboard.getItemById(DashboardWidgetType.KPI, itemId);
final UserDashboardItem kpiItem = getUserDashboardForReading().getItemById(DashboardWidgetType.KPI, itemId);
return JSONDashboardItem.of(kpiItem, newJSONOpts());
}

Expand All @@ -124,8 +123,7 @@ public void changeKPIsDashboard(@RequestBody final List<JSONPatchEvent<Dashboard
{
userSession.assertLoggedIn();

final UserDashboard dashboard = getUserDashboardForWriting();
userDashboardRepo.changeDashboardItems(dashboard, DashboardWidgetType.KPI, events);
userDashboardRepo.changeDashboardItems(getUserDashboardForWriting(), DashboardWidgetType.KPI, events);
}

private final KPIDataResult getKPIData(final UserDashboardItem dashboardItem, final long fromMillis, final long toMillis, final boolean prettyValues)
Expand Down Expand Up @@ -170,10 +168,9 @@ public JSONDashboardItem addTargetIndicatorItem(@RequestBody final JsonUserDashb
{
userSession.assertLoggedIn();

final UserDashboard dashboard = getUserDashboardForWriting();
final int itemId = userDashboardRepo.addUserDashboardItem(dashboard, DashboardWidgetType.TargetIndicator, request);
final int itemId = userDashboardRepo.addUserDashboardItem(getUserDashboardForWriting(), DashboardWidgetType.TargetIndicator, request);

final UserDashboardItem targetIndicatorItem = dashboard.getItemById(DashboardWidgetType.TargetIndicator, itemId);
final UserDashboardItem targetIndicatorItem = getUserDashboardForReading().getItemById(DashboardWidgetType.TargetIndicator, itemId);
return JSONDashboardItem.of(targetIndicatorItem, newJSONOpts());
}

Expand Down

0 comments on commit 2231c59

Please sign in to comment.