@@ -846,7 +846,7 @@ function Index({
846846 darkMode,
847847} ) {
848848 const colors = [ 'purple' , 'green' , 'navy' ] ;
849- const hoursLogged = ( summary . totalSeconds [ weekIndex ] || 0 ) / 3600 ;
849+ const tangibleHoursLogged = ( summary . totalTangibleSeconds ?. [ weekIndex ] || 0 ) / 3600 ;
850850 const currentDate = moment . tz ( TZ ) . startOf ( 'day' ) ;
851851 const [ setTrophyFollowedUp ] = useState ( summary ?. trophyFollowedUp ) ;
852852 const dispatch = useDispatch ( ) ;
@@ -1040,12 +1040,15 @@ function Index({
10401040 ) }
10411041 { Array . isArray ( summary . promisedHoursByWeek ) &&
10421042 summary . promisedHoursByWeek . length > weekIndex &&
1043- showStar ( hoursLogged , summary . promisedHoursByWeek [ weekIndex ] ) && (
1043+ showStar ( tangibleHoursLogged , summary . promisedHoursByWeek [ weekIndex ] ) && (
10441044 < i
10451045 className = "fa fa-star"
10461046 title = { `Weekly Committed: ${ summary . promisedHoursByWeek [ weekIndex ] } hours` }
10471047 style = { {
1048- color : assignStarDotColors ( hoursLogged , summary . promisedHoursByWeek [ weekIndex ] ) ,
1048+ color : assignStarDotColors (
1049+ tangibleHoursLogged ,
1050+ summary . promisedHoursByWeek [ weekIndex ] ,
1051+ ) ,
10491052 fontSize : '55px' ,
10501053 marginLeft : '10px' ,
10511054 verticalAlign : 'middle' ,
@@ -1063,7 +1066,9 @@ function Index({
10631066 fontSize : '10px' ,
10641067 } }
10651068 >
1066- +{ Math . round ( ( hoursLogged / summary . promisedHoursByWeek [ weekIndex ] - 1 ) * 100 ) } %
1069+ +
1070+ { Math . round ( ( tangibleHoursLogged / summary . promisedHoursByWeek [ weekIndex ] - 1 ) * 100 ) }
1071+ %
10671072 </ span >
10681073 </ i >
10691074 ) }
@@ -1082,69 +1087,44 @@ function Index({
10821087 </ small >
10831088 </ p >
10841089 ) }
1085- { /* //newly added */ }
1086- { Array . isArray ( summary . promisedHoursByWeek ) &&
1087- summary . promisedHoursByWeek . length > weekIndex &&
1088- weekIndex !== null &&
1089- weekIndex !== undefined &&
1090- summary . promisedHoursByWeek [ weekIndex ] !== undefined &&
1091- showStar ( hoursLogged , summary . promisedHoursByWeek [ weekIndex ] ) && (
1092- < i
1093- className = "fa fa-star"
1094- title = { `Weekly Committed: ${ summary . promisedHoursByWeek [ weekIndex ] } hours` }
1095- style = { {
1096- color : assignStarDotColors ( hoursLogged , summary . promisedHoursByWeek [ weekIndex ] ) ,
1097- fontSize : '55px' ,
1098- marginLeft : '10px' ,
1099- verticalAlign : 'middle' ,
1100- position : 'relative' ,
1101- } }
1102- >
1103- < span
1104- style = { {
1105- position : 'absolute' ,
1106- top : '50%' ,
1107- left : '50%' ,
1108- transform : 'translate(-50%, -50%)' ,
1109- color : 'white' ,
1110- fontWeight : 'bold' ,
1111- fontSize : '10px' ,
1112- } }
1113- >
1114- +{ Math . round ( ( hoursLogged / summary . promisedHoursByWeek [ weekIndex ] - 1 ) * 100 ) } %
1115- { /* +{Math.round((hoursLogged / promisedHoursByWeek[weekIndex] - 1) * 100)}% */ }
1116- </ span >
1117- </ i >
1118- ) }
11191090 </ >
11201091 ) ;
11211092}
11221093
1123- // FormattedReport.propTypes = {
1124- // // eslint-disable-next-line react/forbid-prop-types
1125- // summaries: PropTypes.arrayOf(PropTypes.object).isRequired,
1126- // weekIndex: PropTypes.number.isRequired,
1127-
1128- // // Adding these to clarify structure for Sonar:
1129- // // summary: PropTypes.shape({
1130- // // _id: PropTypes.string,
1131- // // filterColor: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
1132- // // promisedHoursByWeek: PropTypes.arrayOf(PropTypes.number),
1133- // // weeklySummaries: PropTypes.arrayOf(
1134- // // PropTypes.shape({
1135- // // summary: PropTypes.string,
1136- // // }),
1137- // // ),
1138- // // }),
1139- // };
1094+ Index . propTypes = {
1095+ summary : PropTypes . shape ( {
1096+ _id : PropTypes . string ,
1097+ firstName : PropTypes . string ,
1098+ lastName : PropTypes . string ,
1099+ role : PropTypes . string ,
1100+ totalSeconds : PropTypes . arrayOf ( PropTypes . number ) ,
1101+ totalTangibleSeconds : PropTypes . arrayOf ( PropTypes . number ) ,
1102+ promisedHoursByWeek : PropTypes . arrayOf ( PropTypes . number ) ,
1103+ filterColor : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . arrayOf ( PropTypes . string ) ] ) ,
1104+ adminLinks : PropTypes . array ,
1105+ startDate : PropTypes . string ,
1106+ endDate : PropTypes . string ,
1107+ trophyFollowedUp : PropTypes . bool ,
1108+ timeOffFrom : PropTypes . string ,
1109+ timeOffTill : PropTypes . string ,
1110+ } ) . isRequired ,
1111+ weekIndex : PropTypes . number . isRequired ,
1112+ allRoleInfo : PropTypes . array ,
1113+ auth : PropTypes . object ,
1114+ loadTrophies : PropTypes . bool ,
1115+ handleSpecialColorDotClick : PropTypes . func ,
1116+ isFinalWeek : PropTypes . bool ,
1117+ darkMode : PropTypes . bool ,
1118+ } ;
11401119
11411120FormattedReport . propTypes = {
11421121 summaries : PropTypes . arrayOf (
11431122 PropTypes . shape ( {
11441123 _id : PropTypes . string ,
11451124 filterColor : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . arrayOf ( PropTypes . string ) ] ) ,
11461125 promisedHoursByWeek : PropTypes . arrayOf ( PropTypes . number ) ,
1147- totalSeconds : PropTypes . number ,
1126+ totalSeconds : PropTypes . arrayOf ( PropTypes . number ) ,
1127+ totalTangibleSeconds : PropTypes . arrayOf ( PropTypes . number ) ,
11481128 weeklySummaries : PropTypes . arrayOf ( PropTypes . shape ( { summary : PropTypes . string } ) ) ,
11491129 } ) ,
11501130 ) . isRequired ,
0 commit comments