Refactor Tender Approval Logic and Update Statistics Structure

- Modified the Reject method in the TenderApproval entity to reset the SubmissionMode field upon rejection, ensuring proper state management.
- Simplified the TenderApprovalStatsResponse and CompanyTenderApprovalStatsResponse structures by removing unnecessary fields related to submission modes, streamlining the data model for tender approval statistics.
- Updated the GetTenderApprovalStats and GetCompanyTenderApprovalStats methods in the repository to reflect the changes in the statistics structure, enhancing clarity and maintainability.
- These adjustments improve the overall functionality and data handling of the tender management system.
This commit is contained in:
n.nakhostin
2025-08-25 13:39:28 +03:30
parent 531f8e2baf
commit 488d43380b
4 changed files with 31 additions and 62 deletions
+6 -10
View File
@@ -694,16 +694,12 @@ func (s *tenderApprovalService) GetAggregatedCompanyStats(ctx context.Context) (
// In a real implementation, you might want to get stats for all companies
// and aggregate them properly
stats := &AggregatedCompanyStatsResponse{
TotalCompanies: 1, // This should be calculated from actual company data
TotalApprovals: generalStats.TotalApprovals,
TotalApprovedTenders: generalStats.ApprovedTenders,
TotalRejectedTenders: generalStats.RejectedTenders,
TotalSelfApplyCount: generalStats.ApprovalsBySubmission["self-apply"],
TotalPartnershipCount: generalStats.ApprovalsBySubmission["partnership"],
ApprovalsByStatus: generalStats.ApprovalsByStatus,
ApprovalsBySubmission: generalStats.ApprovalsBySubmission,
CompanyStats: []*CompanyTenderApprovalStatsResponse{}, // Empty for now
LastUpdated: time.Now().Unix(),
TotalCompanies: 1, // This should be calculated from actual company data
TotalApprovals: generalStats.TotalApprovals,
TotalApprovedTenders: generalStats.ApprovedTenders,
TotalRejectedTenders: generalStats.RejectedTenders,
CompanyStats: []*CompanyTenderApprovalStatsResponse{}, // Empty for now
LastUpdated: time.Now().Unix(),
}
s.logger.Info("Aggregated company stats retrieved successfully", map[string]interface{}{