Skip to content

Commit

Permalink
Fix spacing and remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SaamieVincken committed Jan 9, 2024
1 parent 7db6402 commit 98b9e6e
Showing 1 changed file with 20 additions and 39 deletions.
59 changes: 20 additions & 39 deletions Epsilon/Components/KpiMatrixComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,17 @@ public override async Task<Body> AddToWordDocument(MainDocumentPart mainDocument
{
var row = new TableRow();
var outcome = Outcomes.Single(o => o.Id == outcomeCriterion.Id);
row.AppendChild(CreateTableCellWithBorders("2500", new Paragraph(new Run(new Text(outcome.Name)))));


// Create a new paragraph for outcome.Name
var paragraphForOutcomeName = new Paragraph(new Run(new Text(outcome.Name)))
{
ParagraphProperties = new ParagraphProperties
{
Justification = new Justification { Val = JustificationValues.Center, },
},
};
row.AppendChild(CreateTableCellWithBorders("2500", paragraphForOutcomeName));

await foreach (var sub in Submissions)
{
var cell = CreateTableCellWithBorders("100");
Expand All @@ -93,15 +102,21 @@ public override async Task<Body> AddToWordDocument(MainDocumentPart mainDocument
cell.FirstChild?.Append(new Shading { Fill = fillColor, });

var text = result != null ? result.Outcome.Value.ShortName : "";
cell.Append(new Paragraph(new Run(new Text(text))));
var paragraph = new Paragraph();
var run = new Run(new Text(text));
paragraph.Append(run);
paragraph.ParagraphProperties = new ParagraphProperties()
{
Justification = new Justification() { Val = JustificationValues.Center, },
};

cell.Append(paragraph);
row.AppendChild(cell);
}

table.AppendChild(row);
}

// body.AppendChild(await GetLegend());

body.Append(new Paragraph(new Run(new Text(""))));
body.AppendChild(table);

Expand Down Expand Up @@ -132,40 +147,6 @@ private static string GetColor(OutcomeGradeStatus status)
_ => "",
};
}


// private async Task<OpenXmlElement> GetLegend()
// {
// var table = new Table();
// var submissions = await Submissions.ToListAsync();
// var allOutcomes = await GetAllOutcomesAsync();
// foreach (var outcome in allOutcomes)
// {
// foreach (var submission in submissions)
// {
// var criteria = submission.Criteria.FirstOrDefault(c => c.Id == outcome.Id);
// var result = submission.Results.FirstOrDefault(r => r.Outcome.Id == outcome.Id);
// var status = GetStatus(result?.Grade, criteria?.MasteryPoints);
// var color = GetColor(status);
//
// var row = new TableRow();
// var cellName = CreateTableCellWithBorders("200");
// cellName.Append(new Paragraph(new Run(new Text(status.ToString()))));
//
// var cellValue = CreateTableCellWithBorders("200");
// cellValue.Append(new Paragraph(new Run(new Text(""))));
// cellValue.FirstChild?.Append(new Shading
// {
// Fill = color,
// });
// row.AppendChild(cellName);
// row.AppendChild(cellValue);
// table.AppendChild(row);
// }
// }
//
// return table;
// }

private static TableCell CreateTableCellWithBorders(string? width, params OpenXmlElement[] elements)
{
Expand Down

0 comments on commit 98b9e6e

Please sign in to comment.