@@ -572,46 +572,6 @@ private Decimal SafeDivide(Decimal number, Int32 divisor)
572572 return number / divisor ;
573573 }
574574
575- public async Task < TodaysSales > GetProductPerformance ( Guid estateId , DateTime comparisonDate , List < Int32 > productReportingIds , CancellationToken cancellationToken )
576- {
577- using ResolvedDbContext < EstateManagementContext > ? resolvedContext = this . Resolver . Resolve ( EstateManagementDatabaseName , estateId . ToString ( ) ) ;
578- await using EstateManagementContext context = resolvedContext . Context ;
579-
580- // First we need to get a value of todays sales
581- var todaysSalesQuery = ( from t in context . TodayTransactions
582- where t . IsAuthorised && t . TransactionType == "Sale"
583- && t . TransactionDate == DateTime . Now . Date
584- && t . TransactionTime <= DateTime . Now . TimeOfDay
585- select t ) ;
586-
587- var comparisonSalesQuery = ( from t in context . TransactionHistory
588- where t . IsAuthorised && t . TransactionType == "Sale"
589- && t . TransactionDate == comparisonDate
590- && t . TransactionTime <= DateTime . Now . TimeOfDay
591- select t ) ;
592-
593-
594- if ( productReportingIds . Any ( ) )
595- {
596- todaysSalesQuery = todaysSalesQuery . Where ( t => productReportingIds . Contains ( t . ContractProductReportingId ) ) ;
597- comparisonSalesQuery = comparisonSalesQuery . Where ( t => productReportingIds . Contains ( t . ContractProductReportingId ) ) ;
598- }
599-
600- TodaysSales response = new TodaysSales
601- {
602- ComparisonSalesCount = comparisonSalesQuery . Count ( ) ,
603- ComparisonSalesValue = comparisonSalesQuery . Sum ( t => t . TransactionAmount ) ,
604- TodaysSalesCount = todaysSalesQuery . Count ( ) ,
605- TodaysSalesValue = todaysSalesQuery . Sum ( t => t . TransactionAmount ) ,
606- } ;
607- response . ComparisonAverageSalesValue =
608- SafeDivide ( response . ComparisonSalesValue , response . ComparisonSalesCount ) ;
609- response . TodaysAverageSalesValue =
610- SafeDivide ( response . TodaysSalesValue , response . TodaysSalesCount ) ;
611-
612- return response ;
613- }
614-
615575 public async Task < TodaysSales > GetOperatorPerformance ( Guid estateId , DateTime comparisonDate , List < Int32 > operatorReportingIds , CancellationToken cancellationToken ) {
616576 using ResolvedDbContext < EstateManagementContext > ? resolvedContext = this . Resolver . Resolve ( EstateManagementDatabaseName , estateId . ToString ( ) ) ;
617577 await using EstateManagementContext context = resolvedContext . Context ;
0 commit comments