File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed
components/domain/PerAssessmentSummary
AccountMyFormsDref/DrefTableActions Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,9 @@ function PerAssessmentSummary(props: Props) {
139139 * "0"(not - reviewed") component values
140140 */
141141 const filteredComponents = areaResponse ?. component_responses ?. filter (
142- ( component ) => isDefined ( component ?. rating ) && component . rating > 1 ,
142+ ( component ) => isDefined ( component ?. rating_details )
143+ && isDefined ( component . rating_details . value )
144+ && component . rating_details ?. value > 1 ,
143145 ) ?? [ ] ;
144146
145147 if ( filteredComponents . length === 0 ) {
Original file line number Diff line number Diff line change 11{
22 "namespace" : " accountMyFormsDref" ,
33 "strings" : {
4- "dropdownActionApproveLabel" : " Approve " ,
4+ "dropdownActionApproveLabel" : " Approved " ,
55 "dropdownActionAllocationFormLabel" : " Allocation Form" ,
66 "dropdownActionAddOpsUpdateLabel" : " Add Operational Update" ,
77 "dropdownActionCreateFinalReportLabel" : " Create Final Report" ,
Original file line number Diff line number Diff line change @@ -191,9 +191,17 @@ export function Component() {
191191 return total / list . length ;
192192 }
193193
194+ /* NOTE: The calculation of the average rating is done omitting null or
195+ * "0"(not - reviewed") component values
196+ */
197+ const filteredComponents = componentList . filter (
198+ ( component ) => isDefined ( component )
199+ && isDefined ( component . rating ) && component . rating . value > 1 ,
200+ ) ;
201+
194202 const ratingByArea = mapToList (
195203 listToGroupList (
196- componentList . filter ( ( component ) => isDefined ( component . rating ) ) ,
204+ filteredComponents ,
197205 ( component ) => component . area . id ,
198206 ) ,
199207 ( groupedComponentList ) => ( {
@@ -207,7 +215,7 @@ export function Component() {
207215 ) . filter ( isDefined ) ;
208216
209217 const averageRating = getAverage (
210- componentList . map ( ( component ) => component . rating ?. value ) ,
218+ filteredComponents . map ( ( component ) => component . rating ?. value ) ,
211219 ) ;
212220
213221 const ratingCounts = mapToList (
You can’t perform that action at this time.
0 commit comments