public Task ProcessResult(AhkProcessResult value, System.DateTime dateTime) => this.repo.AddResult(new StudentResult( id: null, neptun: value.NeptunCode, gitHubRepoName: value.GitHubRepoName, gitHubPrNumber: value.GitHubPullRequestNum, gitHubPrUrl: value.GitHubPullRequestNum.HasValue ? $"https://github.com/{value.GitHubRepoName}/pull/{value.GitHubPullRequestNum}" : null, date: dateTime, actor: "grade-management-api", origin: formatOrigin(value), points: GetTotalPoints(value.Result), confirmed: false));
private static string formatOrigin(AhkProcessResult value) => string.IsNullOrEmpty(value.Origin) ? $"https://github.com/{value.GitHubRepoName}/commit/{value.GitHubCommitHash}" : value.Origin;
private async Task <IActionResult> runCore(ILogger logger, string deliveryId, AhkProcessResult requestDeserialized, DateTime date) { logger.LogInformation("evaluation-result request with X-Ahk-Delivery='{DeliveryId}' accepted, starting processing", deliveryId); try { await service.ProcessResult(requestDeserialized, date); logger.LogInformation("evaluation-result request handled with success for X-Ahk-Delivery='{DeliveryId}'", deliveryId); return(new OkResult()); } catch (Exception ex) { logger.LogError(ex, "evaluation-result webhook failed for X-Ahk-Delivery='{DeliveryId}'", deliveryId); return(new ObjectResult(new { error = ex.ToString() }) { StatusCode = StatusCodes.Status500InternalServerError }); } }