05c7eae8a2
- Introduced a new configuration file for the TED scraper, defining database connection settings, logging preferences, and scraping parameters. - Implemented a CronScheduler to manage scheduled tasks for TED operations, utilizing the robfig/cron library for scheduling. - Added new entities and structures for handling TED XML data, including eForms and tender-related information, enhancing the scraper's functionality. - Updated the main application to initialize the TED scraper with the new configuration and set up graceful shutdown handling. - Removed the deprecated scraping implementation to streamline the codebase and focus on the new architecture.
55 lines
2.6 KiB
Go
55 lines
2.6 KiB
Go
package eform
|
|
|
|
import "time"
|
|
|
|
// =====================================================
|
|
// LOT RESULT STRUCTURE
|
|
// =====================================================
|
|
|
|
// LotResult represents the outcome of lot procurement
|
|
type LotResult struct {
|
|
ID string `json:"id" xml:"id" validate:"required,resIDFormat"`
|
|
Status ResultStatus `json:"status" xml:"status" validate:"required"`
|
|
StatusDescription string `json:"status_description,omitempty" xml:"status_description,omitempty" validate:"max=10000"`
|
|
DecisionDate *time.Time `json:"decision_date,omitempty" xml:"decision_date,omitempty"`
|
|
TendersReceived int `json:"tenders_received" xml:"tenders_received" validate:"min=0"`
|
|
TendersSME int `json:"tenders_sme" xml:"tenders_sme" validate:"min=0"`
|
|
TendersElectronic int `json:"tenders_electronic" xml:"tenders_electronic" validate:"min=0"`
|
|
TendersOtherEU int `json:"tenders_other_eu" xml:"tenders_other_eu" validate:"min=0"`
|
|
TendersNonEU int `json:"tenders_non_eu" xml:"tenders_non_eu" validate:"min=0"`
|
|
AwardedValue *Money `json:"awarded_value,omitempty" xml:"awarded_value,omitempty"`
|
|
SubcontractingShare *float64 `json:"subcontracting_share,omitempty" xml:"subcontracting_share,omitempty" validate:"omitempty,min=0,max=100"`
|
|
SubcontractingValue *Money `json:"subcontracting_value,omitempty" xml:"subcontracting_value,omitempty"`
|
|
ConcessionRevenue *Money `json:"concession_revenue,omitempty" xml:"concession_revenue,omitempty"`
|
|
Tenders []Tender `json:"tenders,omitempty" xml:"tenders,omitempty" validate:"dive"`
|
|
SettledContract *SettledContract `json:"settled_contract,omitempty" xml:"settled_contract,omitempty"`
|
|
NonAwardJustification string `json:"non_award_justification,omitempty" xml:"non_award_justification,omitempty" validate:"max=10000"`
|
|
}
|
|
|
|
// ResultStatus represents the lot result status
|
|
type ResultStatus string
|
|
|
|
const (
|
|
ResultOpen ResultStatus = "open"
|
|
ResultClose ResultStatus = "close"
|
|
ResultWinner ResultStatus = "winn"
|
|
ResultNoWinner ResultStatus = "no-winn"
|
|
ResultSelected ResultStatus = "selec"
|
|
ResultClosedNoWin ResultStatus = "clos-nw"
|
|
)
|
|
|
|
// HasWinner checks if lot has a winning tender
|
|
func (lr *LotResult) HasWinner() bool {
|
|
return lr.Status == ResultWinner
|
|
}
|
|
|
|
// GetWinningTender returns the winning tender if exists
|
|
func (lr *LotResult) GetWinningTender() *Tender {
|
|
for i := range lr.Tenders {
|
|
if lr.Tenders[i].IsWinner {
|
|
return &lr.Tenders[i]
|
|
}
|
|
}
|
|
return nil
|
|
}
|