From 785e1e6990c44dd11b8d4625f26aa38ab3747f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?= <janis.daehne2@student.uni-halle.de> Date: Sat, 29 Jun 2019 20:55:58 +0200 Subject: [PATCH] - added totalReleases, totalSubmissions, totalTags to dashboard usage --- .../dashboard/DashboardController.cs | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/src/ClientServer/Controllers/dashboard/DashboardController.cs b/src/ClientServer/Controllers/dashboard/DashboardController.cs index 94635e2..3827ce7 100644 --- a/src/ClientServer/Controllers/dashboard/DashboardController.cs +++ b/src/ClientServer/Controllers/dashboard/DashboardController.cs @@ -222,7 +222,7 @@ namespace ClientServer.Controllers Jc.Serialize(new BasicResponse(ResponseCode.NotFound, "systems settings not found"))); return; } - + var settingsFromBackend = SystemSettingsController._CreateSystemSettingsFromBackend(systemSettings); await @@ -270,10 +270,31 @@ namespace ClientServer.Controllers int totalGroupRoles = await _context.GroupRoles.CountAsync(); int totalExercises = await _context.Exercises.CountAsync(); int totalCustomProjects = await _context.CustomProjects.CountAsync(); - int runningAssessments = await _context.ExerciseReleases.CountAsync(p => p.HasAutomaticAssessmentStarted - && p - .HasAutomaticAssessmentFinished == - false); + int runningAssessments = await _context.ExerciseReleases + .CountAsync(p => p.HasAutomaticAssessmentStarted + && p + .HasAutomaticAssessmentFinished == + false); + + + int totalSubmissions = + await _context.ExerciseReleases + .Where(p => p.ExerciseReleaseWithUserAsParticipations.Count >= 5) + .SumAsync(p => p.ExerciseReleaseWithUserAsParticipations.Count); + +// int totalSubmissions2 = +// await _context.ExerciseReleases +// .SumAsync(p => p.ExerciseReleaseWithUserAsParticipations.Count); + + //or maybe only count where we have >2 / >5 submissions? else it's likely to be a test release + //also excludes releases where we have no submissions + int totalReleases = await _context.ExerciseReleases + .CountAsync(p => p.ExerciseReleaseWithUserAsParticipations.Count >= 5); + +// int totalReleases2 = await _context.ExerciseReleases +// .CountAsync(); + + int totalTags = await _context.Tags.CountAsync(); var statistic = new LogicalUsageStatistic() { @@ -284,6 +305,9 @@ namespace ClientServer.Controllers TotalGroupRoles = totalGroupRoles, TotalExercises = totalExercises, TotalCustomProjects = totalCustomProjects, + TotalTags = totalTags, + TotalReleases = totalReleases, + TotalSubmissions = totalSubmissions, RunningAssessments = runningAssessments, }; @@ -419,6 +443,10 @@ namespace ClientServer.Controllers public int TotalExercises { get; set; } public int TotalCustomProjects { get; set; } + public int TotalTags { get; set; } + public int TotalReleases { get; set; } + public int TotalSubmissions { get; set; } + /// <summary> /// the number of running assessments /// </summary> @@ -461,7 +489,7 @@ namespace ClientServer.Controllers public string DashboardScriptPathRelativeToCurrentDir { get; set; } public bool RunAssessmentsAsync { get; set; } public bool IsInitControllerEnabled { get; set; } - + public bool EnsureFileUploadDirStructure { get; set; } public string FileUploadDirRelativePath { get; set; } public string MarkdownAssetFilesUploadDirName { get; set; } -- GitLab