Skip to content

Commit

Permalink
chore: remove the oldData from the summary form pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevespi committed May 10, 2024
1 parent ae52688 commit 5be4286
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 151 deletions.
5 changes: 0 additions & 5 deletions app/components/Form/ProjectAnnualReportFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ const ProjectAnnualReportFormSummary: React.FC<Props> = ({
isPristine
newFormData
operation
formChangeByPreviousFormChangeId {
newFormData
}
formByJsonSchemaName {
jsonSchema
}
Expand Down Expand Up @@ -162,8 +159,6 @@ const ProjectAnnualReportFormSummary: React.FC<Props> = ({
uiSchema={reportingRequirementUiSchema}
formContext={{
operation: annualReport.operation,
oldData:
annualReport.formChangeByPreviousFormChangeId?.newFormData,
latestCommittedData,
isAmendmentsAndOtherRevisionsSpecific:
isOnAmendmentsAndOtherRevisionsPage,
Expand Down
12 changes: 0 additions & 12 deletions app/components/Form/ProjectContactFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,6 @@ const ProjectContactFormSummary: React.FC<Props> = ({
formData={node.newFormData}
formContext={{
operation: node.operation,
oldData: node.formChangeByPreviousFormChangeId?.newFormData,
oldUiSchema: createProjectContactUiSchema(
node?.formChangeByPreviousFormChangeId?.asProjectContact
?.contactByContactId?.fullName
),
latestCommittedData:
latestCommittedContactNode?.node?.newFormData,
latestCommittedUiSchema,
Expand Down Expand Up @@ -260,13 +255,6 @@ const ProjectContactFormSummary: React.FC<Props> = ({
formData={primaryContact ? primaryContact.node.newFormData : null}
formContext={{
operation: primaryContact?.node.operation,
oldData:
primaryContact?.node.formChangeByPreviousFormChangeId
?.newFormData,
oldUiSchema: createProjectContactUiSchema(
primaryContact?.node?.formChangeByPreviousFormChangeId
?.asProjectContact?.contactByContactId?.fullName
),
latestCommittedData:
lastCommittedPrimaryContact?.node?.newFormData,
latestCommittedUiSchema: createProjectContactUiSchema(
Expand Down
27 changes: 0 additions & 27 deletions app/components/Form/ProjectEmissionIntensityReportFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ const ProjectEmissionsIntensityReportFormSummary: React.FC<Props> = ({
formByJsonSchemaName {
jsonSchema
}
formChangeByPreviousFormChangeId {
newFormData
calculatedEiPerformance
paymentPercentage
maximumPerformanceMilestoneAmount
actualPerformanceMilestoneAmount
}
}
}
}
Expand Down Expand Up @@ -97,24 +90,6 @@ const ProjectEmissionsIntensityReportFormSummary: React.FC<Props> = ({
summaryReportingRequirement?.actualPerformanceMilestoneAmount,
};

const oldData = {
...summaryReportingRequirement?.formChangeByPreviousFormChangeId
?.newFormData,
//calculated values
calculatedEiPerformance:
summaryReportingRequirement?.formChangeByPreviousFormChangeId
?.calculatedEiPerformance,
paymentPercentage:
summaryReportingRequirement?.formChangeByPreviousFormChangeId
?.paymentPercentage,
maximumPerformanceMilestoneAmount:
summaryReportingRequirement?.formChangeByPreviousFormChangeId
?.maximumPerformanceMilestoneAmount,
actualPerformanceMilestoneAmount:
summaryReportingRequirement?.formChangeByPreviousFormChangeId
?.actualPerformanceMilestoneAmount,
};

const latestCommittedData = {
...latestCommittedEmissionIntensityReportFormChange?.edges[0]?.node
?.newFormData,
Expand Down Expand Up @@ -147,7 +122,6 @@ const ProjectEmissionsIntensityReportFormSummary: React.FC<Props> = ({
const filteredSchema = getSchemaAndDataIncludingCalculatedValues(
emissionIntensityFormBySlug.jsonSchema.schema as JSONSchema7,
newData,
oldData,
{
// This is only to add the (Adjusted) to the title of the field to differentiate it from the calculated field
adjustedEmissionsIntensityPerformance: {
Expand Down Expand Up @@ -265,7 +239,6 @@ const ProjectEmissionsIntensityReportFormSummary: React.FC<Props> = ({
actualPerformanceMilestoneAmount:
summaryReportingRequirement?.actualPerformanceMilestoneAmount,
operation: summaryReportingRequirement?.operation,
oldData,
latestCommittedData,
isAmendmentsAndOtherRevisionsSpecific:
isOnAmendmentsAndOtherRevisionsPage,
Expand Down
38 changes: 0 additions & 38 deletions app/components/Form/ProjectFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,6 @@ const ProjectFormSummary: React.FC<Props> = ({
name
}
}
formChangeByPreviousFormChangeId {
rank
newFormData
asProject {
operatorByOperatorId {
legalName
bcRegistryId
}
fundingStreamRfpByFundingStreamRfpId {
year
fundingStreamByFundingStreamId {
description
}
}
projectStatusByProjectStatusId {
name
}
}
}
}
latestCommittedProjectFormChanges: latestCommittedFormChangesFor(
formDataTableName: "project"
Expand Down Expand Up @@ -110,23 +91,7 @@ const ProjectFormSummary: React.FC<Props> = ({
// Show diff if it is not the first revision and not view only (rendered from the overview page)
const renderDiff = !isFirstRevision && !viewOnly;

const oldData = {
...projectFormChange.formChangeByPreviousFormChangeId?.newFormData,
rank: projectFormChange.formChangeByPreviousFormChangeId?.rank,
};

const newDataAsProject = projectFormChange.asProject;
const previousDataAsProject =
projectFormChange.formChangeByPreviousFormChangeId?.asProject;

const oldUiSchema = previousDataAsProject
? createProjectUiSchema(
previousDataAsProject.operatorByOperatorId.legalName,
`${previousDataAsProject?.fundingStreamRfpByFundingStreamRfpId?.fundingStreamByFundingStreamId.description} - ${previousDataAsProject?.fundingStreamRfpByFundingStreamRfpId?.year}`,
previousDataAsProject.operatorByOperatorId.bcRegistryId,
previousDataAsProject.projectStatusByProjectStatusId.name
)
: null;

const latestCommittedUiSchema = latestCommittedData?.asProject
? createProjectUiSchema(
Expand All @@ -148,7 +113,6 @@ const ProjectFormSummary: React.FC<Props> = ({
projectSchema as JSONSchema7,

{ ...projectFormChange?.newFormData, rank: projectFormChange.rank },
oldData,
{
rank: {
type: "number",
Expand Down Expand Up @@ -199,8 +163,6 @@ const ProjectFormSummary: React.FC<Props> = ({
formData={formData}
formContext={{
calculatedRank: projectFormChange.rank,
oldData,
oldUiSchema,
latestCommittedData,
latestCommittedUiSchema,
operation: projectFormChange.operation,
Expand Down
41 changes: 1 addition & 40 deletions app/components/Form/ProjectFundingAgreementFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,6 @@ const ProjectFundingAgreementFormSummary: React.FC<Props> = ({
}
}
operation
formChangeByPreviousFormChangeId {
newFormData
eligibleExpensesToDate
holdbackAmountToDate
netPaymentsToDate
grossPaymentsToDate
calculatedTotalPaymentAmountToDate
proponentsSharePercentage
totalProjectValue
anticipatedFundingAmountPerFiscalYear {
edges {
# eslint-disable-next-line relay/unused-fields
node {
anticipatedFundingAmount
fiscalYear
}
}
}
}
}
}
}
Expand Down Expand Up @@ -169,25 +150,6 @@ const ProjectFundingAgreementFormSummary: React.FC<Props> = ({
),
};

const oldFundingFormChanges =
revision.summaryProjectFundingAgreementFormChanges.edges[0]?.node
.formChangeByPreviousFormChangeId;

const oldData = {
...oldFundingFormChanges?.newFormData,
eligibleExpensesToDate: oldFundingFormChanges?.eligibleExpensesToDate,
holdbackAmountToDate: oldFundingFormChanges?.holdbackAmountToDate,
netPaymentsToDate: oldFundingFormChanges?.netPaymentsToDate,
grossPaymentsToDate: oldFundingFormChanges?.grossPaymentsToDate,
totalPaymentAmountToDate:
oldFundingFormChanges?.calculatedTotalPaymentAmountToDate,
proponentsSharePercentage: oldFundingFormChanges?.proponentsSharePercentage,
totalProjectValue: oldFundingFormChanges?.totalProjectValue,
anticipatedFundingAmountPerFiscalYear: cleanupNestedNodes(
oldFundingFormChanges?.anticipatedFundingAmountPerFiscalYear.edges
),
};

const fundingStream =
revision.projectFormChange.asProject.fundingStreamRfpByFundingStreamRfpId
.fundingStreamByFundingStreamId.name;
Expand Down Expand Up @@ -223,7 +185,7 @@ const ProjectFundingAgreementFormSummary: React.FC<Props> = ({
const filteredSchema = getSchemaAndDataIncludingCalculatedValues(
schema as JSONSchema7,
newData,
oldData
latestCommittedData
);

// Set the formSchema and formData based on showing the diff or not
Expand Down Expand Up @@ -342,7 +304,6 @@ const ProjectFundingAgreementFormSummary: React.FC<Props> = ({
fundingAgreementSummary?.totalProjectValue,
calculatedProponentsSharePercentage:
fundingAgreementSummary?.proponentsSharePercentage,
oldData,
latestCommittedData,
isAmendmentsAndOtherRevisionsSpecific:
isOnAmendmentsAndOtherRevisionsPage,
Expand Down
14 changes: 0 additions & 14 deletions app/components/Form/ProjectManagerFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ const ProjectManagerFormSummary: React.FC<Props> = ({
fullName
}
}
formChangeByPreviousFormChangeId {
newFormData
asProjectManager {
cifUserByCifUserId {
fullName
}
}
}
formByJsonSchemaName {
jsonSchema
}
Expand Down Expand Up @@ -146,12 +138,6 @@ const ProjectManagerFormSummary: React.FC<Props> = ({
formData={node.formChange.newFormData}
formContext={{
operation: node.formChange?.operation,
oldData:
node.formChange?.formChangeByPreviousFormChangeId?.newFormData,
oldUiSchema: createProjectManagerUiSchema(
node.formChange?.formChangeByPreviousFormChangeId
?.asProjectManager?.cifUserByCifUserId?.fullName
),
latestCommittedData: latestCommittedManagerNode?.node?.newFormData,
latestCommittedUiSchema,
isAmendmentsAndOtherRevisionsSpecific:
Expand Down
5 changes: 0 additions & 5 deletions app/components/Form/ProjectMilestoneReportFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ const ProjectMilestoneReportFormSummary: React.FC<Props> = ({
isPristine
newFormData
operation
formChangeByPreviousFormChangeId {
newFormData
}
formByJsonSchemaName {
jsonSchema
}
Expand Down Expand Up @@ -243,8 +240,6 @@ const ProjectMilestoneReportFormSummary: React.FC<Props> = ({
calculatedNetAmount:
milestoneReport?.newFormData?.calculatedNetAmount,
operation: milestoneReport.operation,
oldData:
milestoneReport.formChangeByPreviousFormChangeId?.newFormData,
latestCommittedData,
isAmendmentsAndOtherRevisionsSpecific:
isOnAmendmentsAndOtherRevisionsPage,
Expand Down
5 changes: 0 additions & 5 deletions app/components/Form/ProjectQuarterlyReportFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ const ProjectQuarterlyReportFormSummary: React.FC<Props> = ({
isPristine
newFormData
operation
formChangeByPreviousFormChangeId {
newFormData
}
formByJsonSchemaName {
jsonSchema
}
Expand Down Expand Up @@ -169,8 +166,6 @@ const ProjectQuarterlyReportFormSummary: React.FC<Props> = ({
formData={formData}
formContext={{
operation: quarterlyReport.operation,
oldData:
quarterlyReport.formChangeByPreviousFormChangeId?.newFormData,
latestCommittedData,
isAmendmentsAndOtherRevisionsSpecific:
isOnAmendmentsAndOtherRevisionsPage,
Expand Down
5 changes: 0 additions & 5 deletions app/components/Form/ProjectSummaryReportFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ const ProjectSummaryReportFormSummary: React.FC<Props> = ({
node {
newFormData
operation
formChangeByPreviousFormChangeId {
newFormData
}
}
}
}
Expand Down Expand Up @@ -153,8 +150,6 @@ const ProjectSummaryReportFormSummary: React.FC<Props> = ({
uiSchema={projectSummaryReportUiSchema}
formContext={{
operation: projectSummaryReport.operation,
oldData:
projectSummaryReport.formChangeByPreviousFormChangeId?.newFormData,
latestCommittedData:
latestCommittedProjectSummaryFormChanges?.edges[0]?.node
?.newFormData,
Expand Down

0 comments on commit 5be4286

Please sign in to comment.