Skip to content

Commit

Permalink
UIEUS-369-change-reportType-options-for-download simplify return, rem…
Browse files Browse the repository at this point in the history
…ove required
  • Loading branch information
elsenhans committed Nov 11, 2024
1 parent 420cfca commit 7583f15
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/components/Counter/CounterStatistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ const CounterStatistics = ({
const availableReports = getAvailableReports(reports);
const reportNamesNew = availableReports?.map((cr) => getDownloadCounterReportTypes(cr.release, cr.report)).flat();

if (reportNamesNew?.length === 0) {
return null;
} else {
return sortBy(reportNamesNew, ['release', 'label']);
}
return sortBy(reportNamesNew, ['release', 'label']);
};

const [downloadableReports, setDownloadableReports] = useState(calcDownloadableReportTypes());
Expand Down
2 changes: 1 addition & 1 deletion src/components/Counter/DownloadRange/DownloadRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function DownloadRange({
DownloadRange.propTypes = {
downloadableReports: PropTypes.arrayOf(PropTypes.object).isRequired,
handlers: PropTypes.shape({
onDownloadReportMultiMonth: PropTypes.func.isRequired,
onDownloadReportMultiMonth: PropTypes.func,
}).isRequired,
intl: PropTypes.object,
udpId: PropTypes.string.isRequired,
Expand Down
6 changes: 1 addition & 5 deletions src/components/Counter/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,5 @@ export const getAvailableReports = reports => {
})
.map(cr => ({ report: cr.report, release: cr.release }));

if (availableReports.length === 0) {
return null;
} else {
return uniqWith(availableReports, isEqual);
}
return uniqWith(availableReports, isEqual);
};

0 comments on commit 7583f15

Please sign in to comment.