Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/components/WeeklySummariesReport/BioFunction.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* eslint-disable no-nested-ternary */
import { useState } from 'react';
import styles from './WeeklySummariesReport.module.scss';
import ToggleSwitch from '../UserProfile/UserProfileEdit/ToggleSwitch';
import PropTypes from 'prop-types';
import styles from './WeeklySummariesReport.module.scss';

function BioFunction(props) {
const {
bioPosted,
totalTangibleHrs,
daysInTeam,
totalValidWeeklySummaries,
textColors,
summary,
bioCanEdit,
Expand All @@ -17,7 +18,8 @@ function BioFunction(props) {

const [bioStatus, setBioStatus] = useState(bioPosted);

const isMeetCriteria = totalTangibleHrs > 80 && daysInTeam > 60 && bioPosted !== 'posted';
const isMeetCriteria =
totalTangibleHrs > 80 && totalValidWeeklySummaries >= 8 && bioPosted !== 'posted';
const style = {
color: textColors[summary?.weeklySummaryOption] || textColors.Default,
};
Expand Down Expand Up @@ -54,4 +56,15 @@ function BioFunction(props) {
);
}

BioFunction.propTypes = {
bioPosted: PropTypes.string,
totalTangibleHrs: PropTypes.number,
totalValidWeeklySummaries: PropTypes.number,
textColors: PropTypes.object,
summary: PropTypes.object,
bioCanEdit: PropTypes.bool,
handleProfileChange: PropTypes.func,
userId: PropTypes.string,
};

export default BioFunction;
3 changes: 2 additions & 1 deletion src/components/WeeklySummariesReport/FormattedReport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
const isMeetCriteria =
canSeeBioHighlight &&
summary.totalTangibleHrs > 80 &&
summary.daysInTeam > 60 &&
summary.weeklySummariesCount >= 8 &&

Check warning on line 310 in src/components/WeeklySummariesReport/FormattedReport.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'summary.weeklySummariesCount' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ4dVjg7tDLRWaKfuAjW&open=AZ4dVjg7tDLRWaKfuAjW&pullRequest=5261
summary.bioPosted !== 'posted';

return (
Expand Down Expand Up @@ -1105,6 +1105,7 @@
startDate: PropTypes.string,
endDate: PropTypes.string,
trophyFollowedUp: PropTypes.bool,
weeklySummariesCount: PropTypes.number,
timeOffFrom: PropTypes.string,
timeOffTill: PropTypes.string,
}).isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ const WeeklySummariesReport = props => {

const isMeetCriteria =
summary.totalTangibleHrs > 80 &&
summary.daysInTeam > 60 &&
summary.weeklySummariesCount >= 8 &&
summary.bioPosted !== 'posted';

const isBio = !selectedBioStatus || isMeetCriteria;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const colors = {
const baseProps = {
bioPosted: 'default',
totalTangibleHrs: 100,
daysInTeam: 70,
totalValidWeeklySummaries: 10,
textColors: colors,
summary: { weeklySummaryOption: 'option1' },
bioCanEdit: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const dummySummary = {
uploadDate: moment().toISOString(),
},
],
weeklySummariesCount: '5',
weeklySummariesCount: 10,
teamCode: 'ABC123',
mediaUrl: 'http://example.com/media',
adminLinks: [{ Name: 'Media Folder', Link: 'http://example.com/folder' }],
Expand All @@ -71,7 +71,6 @@ const dummySummary = {
.add(1, 'days')
.format(),
totalTangibleHrs: 100,
daysInTeam: 70,
bioPosted: 'default',
weeklySummaryOption: 'Default',
};
Expand Down
Loading