Beispiel #1
0
        public async Task SaveAudioTrancriptionAsync(SaveTranscriptionRequest request, long agentId)
        {
            UnsubscribeFromReopenAudio(request.Transcription.Id);

            await transactionService.CommitAsync(new[] { TransactionContextScope.Main }, async() =>
            {
                await SaveTranscription(request.Transcription, agentId);
                var filter = new WorkingPeriodFilter
                {
                    AgentId = agentId,
                    Type    = LabelingType.Transcription,
                    Action  = LabelingAction.Labeling
                };
                await workingPeriodsService.SaveWorkingPeriodAsync(filter, request.SpentTime);

                if (request.SelectedLabelIds.Any())
                {
                    await labelService.SaveSelectedLabelsAsync(request.SelectedLabelIds, request.Transcription.Id, null);
                }
            });
        }
        public async Task SaveResultAsync(SaveFCMomentResultRequest request, long autorId)
        {
            var fcMomentInfo = await fcMomentsRepository.GetAsync(request.Id);

            fcMomentInfo.InUse          = false;
            fcMomentInfo.AuthorId       = autorId;
            fcMomentInfo.SaveTime       = DateTime.UtcNow;
            fcMomentInfo.BestAnswerTime = TimeSpan.FromSeconds(request.BestAnswerTime);
            fcMomentInfo.SelectedAms    = request.Result;
            fcMomentInfo.IsPerfect      = request.IsPerfect;

            UnsubscribeFromReopenAudio(fcMomentInfo.Id);
            await transactionService.CommitAsync(new[] { TransactionContextScope.Main }, async() =>
            {
                await fcMomentsRepository.UpdateAsync(fcMomentInfo);
                var filter = new WorkingPeriodFilter
                {
                    AgentId = autorId,
                    Type    = LabelingType.FullConversationMoments,
                    Action  = LabelingAction.Labeling
                };
                await workingPeriodsService.SaveWorkingPeriodAsync(filter, request.SpentTime);
            });
        }