File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/components/progress-summary Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export class ProgressSummaryExtractor {
18
18
return {
19
19
reportPeriod : summaryFrom ( yearRow , quarterCol , quarterCol ) ,
20
20
fiscalYear : summaryFrom ( yearRow , ...sheet . columnsForFiscalYear ) ,
21
- cumulative : summaryFrom ( yearRow , ... sheet . columnsForCumulative ) ,
21
+ cumulative : findLatestCumulative ( yearRow ) ,
22
22
} ;
23
23
}
24
24
}
@@ -32,6 +32,21 @@ const findFiscalYearRow = (sheet: ProgressSheet, fiscalYear: number) => {
32
32
throw new Error ( 'Unable to find fiscal year in pnp file' ) ;
33
33
} ;
34
34
35
+ const findLatestCumulative = ( currentYear : Row < ProgressSheet > ) => {
36
+ const { sheet } = currentYear ;
37
+ // eslint-disable-next-line no-constant-condition
38
+ while ( true ) {
39
+ const summary = summaryFrom ( currentYear , ...sheet . columnsForCumulative ) ;
40
+ if ( summary ) {
41
+ return summary ;
42
+ }
43
+ currentYear = currentYear . move ( - 1 ) ;
44
+ if ( currentYear < sheet . summaryFiscalYears . start . row ) {
45
+ return null ;
46
+ }
47
+ }
48
+ } ;
49
+
35
50
const summaryFrom = (
36
51
fiscalYear : Row < ProgressSheet > ,
37
52
plannedColumn : Column ,
You can’t perform that action at this time.
0 commit comments