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:
@@ -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{}{
|
||||
|
||||
Reference in New Issue
Block a user