Skip to content

Commit

Permalink
Merge pull request #1220 from DFE-Digital/bug/187709-unable-download-…
Browse files Browse the repository at this point in the history
…project-template

Download form-a-mat project template without setting number of sites information
  • Loading branch information
mshakirdfe authored Nov 12, 2024
2 parents 60a21d8 + fbd50ed commit 88b259f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ public static TextElement[] SanitizeTextElements(TextElement[] elements)
// Utility method to create and sanitize TextElement arrays
public static TextElement[] CreateTextElements(string label, string value)
{
return SanitizeTextElements(new[]
{
return SanitizeTextElements(
[
new TextElement { Value = label, Bold = true },
new TextElement { Value = value }
});
]);
}
public static TextElement[] CreateSingleTextElement(string value)
{
return new TextElement[]
{
new() { Value = SanitizeString(value) }
};
return
[
new() { Value = SanitizeString(value) }
];
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ public static void AddRationale(IDocumentBuilder builder, HtbTemplate document,
if (!project.AcademyTypeAndRoute.Equals(AcademyTypeAndRoutes.Sponsored))
{
build.AddHeading("Rationale for the project", HeadingLevel.Two);
build.AddTable(new List<TextElement[]>
{
build.AddTable(
[
DocumentGeneratorStringSanitiser.CreateSingleTextElement(document.RationaleForProject ?? "N/A")
});
]);
}

build.AddHeading("Rationale for the trust or sponsor", HeadingLevel.Two);
build.AddTable(new List<TextElement[]>
{
build.AddTable(
[
DocumentGeneratorStringSanitiser.CreateSingleTextElement(document.RationaleForTrust ?? "N/A")
});
]);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public static void AddRisksAndIssues(IDocumentBuilder builder, HtbTemplate docum
builder.ReplacePlaceholderWithContent("RisksAndIssuesInformation", build =>
{
build.AddHeading("Risks and issues", HeadingLevel.One);
build.AddTable(new List<TextElement[]>
{
build.AddTable(
[
DocumentGeneratorStringSanitiser.CreateSingleTextElement(document.RisksAndIssues ?? "N/A")
});
]);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private static void AddAdvisoryBoardDetails(IDocumentBuilder builder, AcademyCon
{
List<TextElement[]> advisoryBoardDetails = new()
{
DocumentGeneratorStringSanitiser.CreateTextElements("Date of advisory board", project.HeadTeacherBoardDate.ToDateString()),
DocumentGeneratorStringSanitiser.CreateTextElements("Date of advisory board", project.HeadTeacherBoardDate?.ToDateString()),
DocumentGeneratorStringSanitiser.CreateTextElements("Proposed academy opening date", project.ProposedConversionDate.ToDateString()),
DocumentGeneratorStringSanitiser.CreateTextElements("Previous advisory board", project.PreviousHeadTeacherBoardDate.ToDateString())
};
Expand Down Expand Up @@ -64,14 +64,14 @@ private static List<TextElement[]> VoluntaryRouteInfo(AcademyConversionProject p
var voluntaryRouteInfo = new List<TextElement[]>
{
DocumentGeneratorStringSanitiser.CreateTextElements("Academy type and route", project.AcademyTypeAndRoute),
DocumentGeneratorStringSanitiser.CreateTextElements("Grant funding amount", project.ConversionSupportGrantAmount.ToMoneyString(true)),
DocumentGeneratorStringSanitiser.CreateTextElements("Grant funding amount", project.ConversionSupportGrantAmount?.ToMoneyString(true)),
DocumentGeneratorStringSanitiser.CreateTextElements("Grant funding reason", project.ConversionSupportGrantChangeReason),
DocumentGeneratorStringSanitiser.CreateTextElements("Recommendation", project.RecommendationForProject)
};

if (project.SchoolType.ToLower().Contains("pupil referral unit"))
{
voluntaryRouteInfo.Add(DocumentGeneratorStringSanitiser.CreateTextElements("Number of sites", project.ConversionSupportGrantNumberOfSites.ToString()));
voluntaryRouteInfo.Add(DocumentGeneratorStringSanitiser.CreateTextElements("Number of sites", project.ConversionSupportGrantNumberOfSites?.ToString()));
}

return voluntaryRouteInfo;
Expand All @@ -83,17 +83,17 @@ private static List<TextElement[]> SponsoredRouteInfo(AcademyConversionProject p
{
DocumentGeneratorStringSanitiser.CreateTextElements("Academy type and route", project.AcademyTypeAndRoute),
DocumentGeneratorStringSanitiser.CreateTextElements("Grant funding type", project.ConversionSupportGrantType),
DocumentGeneratorStringSanitiser.CreateTextElements("Grant funding amount", project.ConversionSupportGrantAmount.ToMoneyString(true)),
DocumentGeneratorStringSanitiser.CreateTextElements("Grant funding amount", project.ConversionSupportGrantAmount?.ToMoneyString(true)),
DocumentGeneratorStringSanitiser.CreateTextElements("Grant funding reason", project.ConversionSupportGrantChangeReason),
DocumentGeneratorStringSanitiser.CreateTextElements("Is the school applying for an EIG (Environmental Improvement Grant)?", project.ConversionSupportGrantEnvironmentalImprovementGrant),
DocumentGeneratorStringSanitiser.CreateTextElements("Has the Schools Notification Mailbox (SNM) received a Form 7?", project.Form7Received),
DocumentGeneratorStringSanitiser.CreateTextElements("Date SNM received Form 7", project.Form7ReceivedDate.ToDateString()),
DocumentGeneratorStringSanitiser.CreateTextElements("Date directive academy order (DAO) pack sent", project.DaoPackSentDate.ToDateString())
DocumentGeneratorStringSanitiser.CreateTextElements("Date SNM received Form 7", project.Form7ReceivedDate?.ToDateString()),
DocumentGeneratorStringSanitiser.CreateTextElements("Date directive academy order (DAO) pack sent", project.DaoPackSentDate?.ToDateString())
};

if (project.SchoolType.ToLower().Contains("pupil referral unit"))
{
sponsoredRouteInfo.Add(DocumentGeneratorStringSanitiser.CreateTextElements("Number of sites", project.ConversionSupportGrantNumberOfSites.ToString()));
sponsoredRouteInfo.Add(DocumentGeneratorStringSanitiser.CreateTextElements("Number of sites", project.ConversionSupportGrantNumberOfSites?.ToString()));
}

return sponsoredRouteInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public static void AddSchoolBudgetInformation(IDocumentBuilder builder, HtbTempl
builder.ReplacePlaceholderWithContent("SchoolBudgetInformation", build =>
{
build.AddHeading("Budget information", HeadingLevel.One);
build.AddTable(new List<TextElement[]>
{
build.AddTable(
[
// Current financial year
new[] { new TextElement { Value = "End of current financial year", Bold = true }, new TextElement { Value = document.EndOfCurrentFinancialYear } },
new[] { new TextElement { Value = "Forecast revenue carry forward at the end of the current financial year", Bold = true }, new TextElement { Value = document.RevenueCarryForwardAtEndMarchCurrentYear } },
Expand All @@ -23,7 +23,7 @@ public static void AddSchoolBudgetInformation(IDocumentBuilder builder, HtbTempl
new[] { new TextElement { Value = "Forecast revenue carry forward at the end of the next financial year", Bold = true }, new TextElement { Value = document.ProjectedRevenueBalanceAtEndMarchNextYear } },
new[] { new TextElement { Value = "Forecast capital carry forward at the end of the next financial year", Bold = true }, new TextElement { Value = document.CapitalCarryForwardAtEndMarchNextYear } },
new[] { new TextElement { Value = "Additional information", Bold = true }, new TextElement { Value = document.SchoolBudgetInformationAdditionalInformation } },
});
]);
});
}
}
Expand Down

0 comments on commit 88b259f

Please sign in to comment.