Skip to content

Commit

Permalink
Merge pull request edp963#1797 from scottsut/fix_download_statistic
Browse files Browse the repository at this point in the history
fix(statistic): Statistic request error of dashboard without global c…
  • Loading branch information
ruanhan authored Jun 12, 2020
2 parents d8781e2 + 555ceb3 commit 1d0fda2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion webapp/app/components/StarPanel/Star.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import React from 'react'
import { IStar, IEvent, IStarUserList } from './type'
const styles = require('./Star.less')
import StarUser from './Staruser'
import StarUser from './StarUser'

function stopPPG(e: IEvent) {
e.stopPropagation()
Expand Down
26 changes: 12 additions & 14 deletions webapp/app/containers/Dashboard/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import {
makeSelectCurrentDashboard,
makeSelectWidgets,
makeSelectItemRelatedWidget,
makeSelectItemInfo
makeSelectItemInfo,
makeSelectCurrentItems
} from './selectors'
import {
makeSelectGlobalControlPanelFormValues,
Expand Down Expand Up @@ -416,34 +417,31 @@ export function* initiateDownloadTask(action: DashboardActionType) {
const downloadInfo: IDataDownloadStatistic[] = []

if (type === DownloadTypes.Dashboard) {
const globalControlConditionsByItemEntries: Array<
[string, IGlobalControlConditions]
> = Object.entries(globalControlConditionsByItem)
while (globalControlConditionsByItemEntries.length) {
const [
relatedItemId,
globalControlConditions
] = globalControlConditionsByItemEntries[0]
const currentItems = yield select(makeSelectCurrentItems())
const itemIds = currentItems.map((item) => item.id)
while (itemIds.length) {
const itemId = itemIds[0]
const globalControlConditions = globalControlConditionsByItem[itemId]
const itemInfo: IDashboardItemInfo = yield select((state) =>
makeSelectItemInfo()(state, Number(relatedItemId))
makeSelectItemInfo()(state, itemId)
)
const relatedWidget: IWidgetFormed = yield select((state) =>
makeSelectItemRelatedWidget()(state, Number(relatedItemId))
makeSelectItemRelatedWidget()(state, itemId)
)
const localControlFormValues = yield select((state) =>
makeSelectLocalControlPanelFormValues()(state, Number(relatedItemId))
makeSelectLocalControlPanelFormValues()(state, itemId)
)
downloadInfo.push(
getDownloadInfo(
type,
Number(relatedItemId),
itemId,
itemInfo,
relatedWidget,
localControlFormValues,
globalControlConditions
)
)
globalControlConditionsByItemEntries.shift()
itemIds.shift()
}
} else {
const itemInfo: IDashboardItemInfo = yield select((state) =>
Expand Down

0 comments on commit 1d0fda2

Please sign in to comment.