Exemplo n.º 1
0
        public async Task <ActionResult> StartSynthesisEvaluationAsync([FromBody] StartTestEvalulationSynthesis model)
        {
            var userId = UserId;
            var jobId  = $"evaluate_synthesis_{model.TestId}";

            foreach (var request in model.EvaluationRequests)
            {
                _queue.QueueAsyncTask(() => EvaluateSynthesisPaper(_serviceScopeFactory, jobId, model.TestId, request.StudentId, request.UseSecretData, userId));

                //SET STATUS IN DB TO Queued -> To be implemented (remove synthesis paper entity first): posalji timeStamp sa FE + novi setStatus endpoint koji sam pravi entity

                await _synthesisSignalR.SendMessageAsync(jobId, "synthesisEvaluationUpdate", new
                {
                    id     = request.StudentId,
                    secret = request.UseSecretData,
                    status = (int)EvaluationProgress.Queued
                });
            }

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <ActionResult> StartAnalysisEvaluationAsync([FromBody] StartTestEvalulationAnalysis model)
        {
            var userId = UserId;
            var jobId  = $"evaluate_analysis_{model.TestId}";

            foreach (var studentId in model.StudentIds)
            {
                _queue.QueueAsyncTask(() => EvaluateAnalysisPaper(_serviceScopeFactory, jobId, model.TestId, studentId, userId));

                //SET STATUS IN DB TO Queued

                await _analysisSignalR.SendMessageAsync(jobId, "analysisEvaluationUpdate", new
                {
                    id     = studentId,
                    type   = (int)AnalysisEvaluationType.PrepareData,
                    status = (int)EvaluationProgress.Queued
                });
            }

            return(Ok());
        }