| | | 1 | | using Services.TransactionUtilsServices; |
| | | 2 | | |
| | | 3 | | namespace OzonOrdersWeb.WebServices.Transactions.Grid.Commit.Steps; |
| | | 4 | | |
| | | 5 | | /// <summary>Завершение сессии учёта времени (ключ выдан при Load).</summary> |
| | | 6 | | public sealed class TimeTrackingStep : ITransactionCommitStep |
| | | 7 | | { |
| | | 8 | | private readonly ITransactionTimeTrackingService? _tracking; |
| | | 9 | | |
| | 0 | 10 | | public TimeTrackingStep(ITransactionTimeTrackingService? tracking = null) |
| | | 11 | | { |
| | 0 | 12 | | _tracking = tracking; |
| | 0 | 13 | | } |
| | | 14 | | |
| | 0 | 15 | | public string Key => TransactionCommitStepKeys.TimeTracking; |
| | | 16 | | |
| | | 17 | | public async Task ExecuteAsync(TransactionCommitContext ctx) |
| | | 18 | | { |
| | 0 | 19 | | if (_tracking == null || ctx.TransactionId <= 0 || string.IsNullOrWhiteSpace(ctx.Request.TrackingKey)) |
| | | 20 | | { |
| | 0 | 21 | | return; |
| | | 22 | | } |
| | | 23 | | |
| | 0 | 24 | | var comment = TransactionServices.TransactionCommentAiSchedulingHelper.ResolveCommentForDatabase( |
| | 0 | 25 | | ctx.CommentFlow.UserCommentOnly, ctx.CommentFlow.ScheduleAiComment, ctx.TechnicalComment); |
| | 0 | 26 | | await _tracking.CompleteSessionAsync( |
| | 0 | 27 | | ctx.Request.TrackingKey, ctx.TransactionId, ctx.OrdersToTransaction.Count, comment, |
| | 0 | 28 | | $"/Studio2/Transaction/GetTransaction?transactionId={ctx.TransactionId}"); |
| | 0 | 29 | | } |
| | | 30 | | } |