Skip to content

Commit

Permalink
feat: add chronological ordering function as comments (TBC)
Browse files Browse the repository at this point in the history
  • Loading branch information
BCerki committed May 13, 2022
1 parent a0547d7 commit 57d4bdb
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions app/components/Form/ProjectQuarterlyReportForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ const ProjectQuarterlyReportForm: React.FC<Props> = (props) => {
props.projectRevision
);

console.log("projectrevision", projectRevision);

const [addQuarterlyReportMutation, isAdding] =
useAddReportingRequirementToRevision();

Expand Down Expand Up @@ -213,6 +211,18 @@ const ProjectQuarterlyReportForm: React.FC<Props> = (props) => {
}
};

//// function to order reports chronologically
// const allQuarterlyReports = useMemo(() => {
// const forms = [...projectRevision.projectQuarterlyReportFormChanges.edges];
// const sorted = forms.sort((a, b) => {
// return (
// +new Date(a.node.newFormData.dueDate) -
// +new Date(b.node.newFormData.dueDate)
// );
// });
// return sorted;
// }, [projectRevision.projectQuarterlyReportFormChanges.edges]);

return (
<div>
<header>
Expand All @@ -233,6 +243,7 @@ const ProjectQuarterlyReportForm: React.FC<Props> = (props) => {
</Button>
</Grid.Row>
{projectRevision.projectQuarterlyReportFormChanges.edges.map(
// {allQuarterlyReports.map
({ node }, index) => {
return (
<Grid.Row key={node.id} className="reportContainer">
Expand Down

0 comments on commit 57d4bdb

Please sign in to comment.