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 committed Jun 23, 2017
1 parent faa1405 commit fc5edb3
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,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 @@ -132,8 +131,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 @@ -178,10 +176,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 fc5edb3

Please sign in to comment.