Skip to content

Commit

Permalink
Process Summary Email Utils contd...
Browse files Browse the repository at this point in the history
  • Loading branch information
bibekaryal86 committed Jul 24, 2024
1 parent 89fab0a commit 00310e3
Showing 1 changed file with 18 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,7 @@ public static synchronized String getProcessSummaryContent(ProcessSummary proces
</tr>
""");

for (ProcessedRepository processedRepository : prCreatedAndMerged) {
html.append("<tr>");
html.append("<td>").append(processedRepository.getRepoName()).append("</td>");
html.append("<td>").append(processedRepository.getRepoType()).append("</td>");
html.append("<td>").append(processedRepository.isPrCreated() ? "Y" : "N").append("</td>");
html.append("<td>")
.append(processedRepository.isPrCreateError() ? "Y" : "N")
.append("</td>");
html.append("<td>").append(processedRepository.isPrMerged() ? "Y" : "N").append("</td>");
html.append("</tr>");
}

html.append("""
</table>
""");
processedRepositoryTable(prCreatedAndMerged, html);
}

if (prCreatedNotMerged.isEmpty()) {
Expand All @@ -169,21 +155,7 @@ public static synchronized String getProcessSummaryContent(ProcessSummary proces
</tr>
""");

for (ProcessedRepository processedRepository : prCreatedNotMerged) {
html.append("<tr>");
html.append("<td>").append(processedRepository.getRepoName()).append("</td>");
html.append("<td>").append(processedRepository.getRepoType()).append("</td>");
html.append("<td>").append(processedRepository.isPrCreated() ? "Y" : "N").append("</td>");
html.append("<td>")
.append(processedRepository.isPrCreateError() ? "Y" : "N")
.append("</td>");
html.append("<td>").append(processedRepository.isPrMerged() ? "Y" : "N").append("</td>");
html.append("</tr>");
}

html.append("""
</table>
""");
processedRepositoryTable(prCreatedNotMerged, html);
}

if (prCreateError.isEmpty()) {
Expand All @@ -208,21 +180,7 @@ public static synchronized String getProcessSummaryContent(ProcessSummary proces
</tr>
""");

for (ProcessedRepository processedRepository : prCreateError) {
html.append("<tr>");
html.append("<td>").append(processedRepository.getRepoName()).append("</td>");
html.append("<td>").append(processedRepository.getRepoType()).append("</td>");
html.append("<td>").append(processedRepository.isPrCreated() ? "Y" : "N").append("</td>");
html.append("<td>")
.append(processedRepository.isPrCreateError() ? "Y" : "N")
.append("</td>");
html.append("<td>").append(processedRepository.isPrMerged() ? "Y" : "N").append("</td>");
html.append("</tr>");
}

html.append("""
</table>
""");
processedRepositoryTable(prCreateError, html);
}

html.append(
Expand All @@ -239,7 +197,19 @@ public static synchronized String getProcessSummaryContent(ProcessSummary proces
</tr>
""");

for (ProcessedRepository processedRepository : allProcessedRepositories) {
processedRepositoryTable(allProcessedRepositories, html);

html.append("""
</body>
</html>
""");

return html.toString();
}

private static void processedRepositoryTable(
List<ProcessedRepository> processedRepositories, StringBuilder html) {
for (ProcessedRepository processedRepository : processedRepositories) {
html.append("<tr>");
html.append("<td>").append(processedRepository.getRepoName()).append("</td>");
html.append("<td>").append(processedRepository.getRepoType()).append("</td>");
Expand All @@ -250,11 +220,7 @@ public static synchronized String getProcessSummaryContent(ProcessSummary proces
}

html.append("""
</table>
</body>
</html>
""");

return html.toString();
</table>
""");
}
}

0 comments on commit 00310e3

Please sign in to comment.