Skip to content

Commit f2e620f

Browse files
committed
TD-5263 Checks that framework competency group is not empty before rendering
1 parent 8b198f4 commit f2e620f

File tree

1 file changed

+45
-42
lines changed

1 file changed

+45
-42
lines changed

DigitalLearningSolutions.Web/Views/Frameworks/Developer/FrameworkPrintLayout.cshtml

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -50,51 +50,54 @@
5050
{
5151
@foreach (var frameworkCompetencyGroup in Model.FrameworkCompetencyGroups)
5252
{
53-
groupNum++;
54-
<h3>@frameworkCompetencyGroup.Name</h3>
55-
if (frameworkCompetencyGroup.Description != null)
53+
if (frameworkCompetencyGroup.FrameworkCompetencies.Count() > 0)
5654
{
57-
<p class="nhsuk-lede-text">
58-
@frameworkCompetencyGroup.Description
59-
</p>
60-
}
61-
62-
int compNum = 0;
63-
if (frameworkCompetencyGroup.FrameworkCompetencies[0] != null)
64-
{
65-
<table class="nhsuk-table">
66-
<thead role="rowgroup" class="nhsuk-table__head">
67-
<tr role="row">
68-
<th role="columnheader" class="" scope="col">
69-
@Model.VocabSingular()
70-
</th>
71-
<th role="columnheader" class="status-tag" scope="col">
72-
Date and Signature
73-
</th>
74-
</tr>
75-
</thead>
76-
<tbody class="nhsuk-table__body">
77-
@foreach (var frameworkCompetency in frameworkCompetencyGroup.FrameworkCompetencies)
78-
{
79-
compNum++;
80-
<tr role="row" class="nhsuk-table__row">
81-
<td>
82-
<strong>@frameworkCompetency.Name</strong>
55+
groupNum++;
56+
<h3>@frameworkCompetencyGroup.Name</h3>
57+
if (frameworkCompetencyGroup.Description != null)
58+
{
59+
<p class="nhsuk-lede-text">
60+
@frameworkCompetencyGroup.Description
61+
</p>
62+
}
8363

84-
<partial name="_CompetencyFlags" model="Model.CompetencyFlags.Where(c => c.CompetencyId == frameworkCompetency.CompetencyID)" />
85-
@if (frameworkCompetency.Description != null)
86-
{
87-
<p class="nhsuk-lede-text--small">
88-
@Html.Raw(frameworkCompetency.Description)
89-
</p>
90-
}
91-
</td>
92-
<td>
93-
</td>
64+
int compNum = 0;
65+
if (frameworkCompetencyGroup.FrameworkCompetencies[0] != null)
66+
{
67+
<table class="nhsuk-table">
68+
<thead role="rowgroup" class="nhsuk-table__head">
69+
<tr role="row">
70+
<th role="columnheader" class="" scope="col">
71+
@Model.VocabSingular()
72+
</th>
73+
<th role="columnheader" class="status-tag" scope="col">
74+
Date and Signature
75+
</th>
9476
</tr>
95-
}
96-
</tbody>
97-
</table>
77+
</thead>
78+
<tbody class="nhsuk-table__body">
79+
@foreach (var frameworkCompetency in frameworkCompetencyGroup.FrameworkCompetencies)
80+
{
81+
compNum++;
82+
<tr role="row" class="nhsuk-table__row">
83+
<td>
84+
<strong>@frameworkCompetency.Name</strong>
85+
86+
<partial name="_CompetencyFlags" model="Model.CompetencyFlags.Where(c => c.CompetencyId == frameworkCompetency.CompetencyID)" />
87+
@if (frameworkCompetency.Description != null)
88+
{
89+
<p class="nhsuk-lede-text--small">
90+
@Html.Raw(frameworkCompetency.Description)
91+
</p>
92+
}
93+
</td>
94+
<td>
95+
</td>
96+
</tr>
97+
}
98+
</tbody>
99+
</table>
100+
}
98101
}
99102
}
100103
}

0 commit comments

Comments
 (0)