public Task <WorkingPeriod> GetAsync(WorkingPeriodFilter filter)
 {
     return(workingPeriodsDataSet
            .Where(period => period.AgentId == filter.AgentId)
            .Where(period => period.Date == DateTime.UtcNow.Date)
            .Where(period => period.Type == filter.Type)
            .Where(period => period.Action == filter.Action)
            .SingleOrDefaultAsync());
 }
Esempio n. 2
0
        public async Task ReleaseTranscriptionAsync(ReleaseFromProcessingRequest request, long agentId)
        {
            await ReleaseTranscription(request.Id);

            var filter = new WorkingPeriodFilter
            {
                AgentId = agentId,
                Type    = LabelingType.Transcription,
                Action  = request.Action
            };
            await workingPeriodsService.SaveWorkingPeriodAsync(filter, request.SpentTime);
        }
Esempio n. 3
0
        public async Task ReleaseMomentAsync(ReleaseFromProcessingRequest request, long agentId)
        {
            await ReleaseMoment(request.Id);

            var filter = new WorkingPeriodFilter
            {
                AgentId = agentId,
                Type    = LabelingType.FullConversationMoments,
                Action  = request.Action
            };
            await workingPeriodsService.SaveWorkingPeriodAsync(filter, request.SpentTime);
        }
Esempio n. 4
0
 public async Task SaveAudioVerificationAsync(SaveTranscriptionRequest request, long agentId)
 {
     UnsubscribeFromReopenAudio(request.Transcription.Id);
     await transactionService.CommitAsync(new[] { TransactionContextScope.Main }, async() =>
     {
         await SaveVerifiedTranscription(request.Transcription, agentId);
         var filter = new WorkingPeriodFilter
         {
             AgentId = agentId,
             Type    = LabelingType.Transcription,
             Action  = LabelingAction.Verification
         };
         await workingPeriodsService.SaveWorkingPeriodAsync(filter, request.SpentTime);
         await UpdateLabels(request.SelectedLabelIds, request.Transcription.Id);
     });
 }
Esempio n. 5
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);
                }
            });
        }
Esempio n. 6
0
        public async Task SaveWorkingPeriodAsync(WorkingPeriodFilter filter, long spentTime)
        {
            var savedTime = await workingPeriodsRepository.GetAsync(filter);

            if (savedTime != null)
            {
                savedTime.Duration += TimeSpan.FromMilliseconds(spentTime);
                await workingPeriodsRepository.UpdateAsync(savedTime);

                return;
            }

            var timeModeltoSave = new WorkingPeriod
            {
                AgentId  = filter.AgentId,
                Date     = DateTime.UtcNow.Date,
                Type     = filter.Type,
                Action   = filter.Action,
                Duration = TimeSpan.FromMilliseconds(spentTime)
            };

            await workingPeriodsRepository.AddAsync(timeModeltoSave);
        }
Esempio n. 7
0
        public async Task SaveVerificationResultAsync(SaveFCMomentResultRequest request, long autorId)
        {
            var fcMomentInfo = await fcMomentsRepository.GetAsync(request.Id);

            fcMomentInfo.InUse            = false;
            fcMomentInfo.VerifierId       = autorId;
            fcMomentInfo.VerificationTime = 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.Verification
                };
                await workingPeriodsService.SaveWorkingPeriodAsync(filter, request.SpentTime);
            });
        }