Skip to content

Commit 5aa56db

Browse files
authored
Add conversion statistics (#2642)
1 parent ba43e68 commit 5aa56db

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
@page "/admin/inactive-projects-mass-convert-to-slot"
22
@model JoinRpg.Portal.Pages.Admin.ConvertInactiveProjectsToSlotsModel
33
@{
4+
<h2>Массовое преобразование</h2>
5+
<div>
6+
Found @Model.InactiveProjectsWithGroupCount, converted @Model.ConvertedSuccessCount, failed to convert @Model.FailedCount.
7+
</div>
48
}

src/JoinRpg.Portal/Pages/Admin/ConvertInactiveProjectsToSlots.cshtml.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@ public class ConvertInactiveProjectsToSlotsModel(
1313
ILogger<ConvertInactiveProjectsToSlotsModel> logger
1414
) : PageModel
1515
{
16+
17+
public int InactiveProjectsWithGroupCount { get; private set; }
18+
public int ConvertedSuccessCount { get; private set; }
19+
public int FailedCount { get; private set; }
20+
1621
public async Task OnGet()
1722
{
1823
var projects = await projectRepository.GetInactiveProjectsWithSlots();
1924

25+
InactiveProjectsWithGroupCount = projects.Length;
26+
27+
ConvertedSuccessCount = FailedCount = 0;
28+
29+
2030
logger.LogInformation("Found {count} projects to convert", projects.Length);
2131

2232
foreach (var projectId in projects)
@@ -27,10 +37,12 @@ public async Task OnGet()
2737
logger.LogInformation("About to convert {projectId} to slots", id);
2838
await slotMassConvertService.MassConvert(id);
2939
logger.LogInformation("Converted {projectId} to slots", id);
40+
ConvertedSuccessCount++;
3041
}
3142
catch (Exception exception)
3243
{
3344
logger.LogError(exception, "Failing to convert {projectId} to slots, skipping", projectId);
45+
FailedCount++;
3446
}
3547
}
3648

0 commit comments

Comments
 (0)