Refactor document scraper to utilize active publication windows for tender retrieval
continuous-integration/drone/push Build is passing

- Updated the ListPendingTenders method to filter tenders based on their active publication submission window instead of just deadlines, enhancing the accuracy of tender listings.
- Introduced a new HasActivePublicationWindow method in the Tender entity to determine if the publication-based submission window is still open.
- Modified the GetTenderByNoticeID method to reflect the new logic for filtering tenders based on their publication status.
- Enhanced the documentation for relevant API endpoints to clarify the changes in tender retrieval criteria.

This update improves the precision of tender scraping by ensuring only relevant tenders with active submission windows are processed, contributing to better data management and scraping efficiency.
This commit is contained in:
Mazyar
2026-07-01 19:22:45 +03:30
parent 7a9de273bb
commit c46a8d54f4
5 changed files with 111 additions and 28 deletions
+7 -5
View File
@@ -280,6 +280,12 @@ func (t *Tender) PublicationSubmissionDeadline() int64 {
return ted.CalculateSubmissionDeadline(time.Unix(t.PublicationDate, 0)).Unix()
}
// HasActivePublicationWindow reports whether the publication-based submission window is still open.
func (t *Tender) HasActivePublicationWindow(now int64) bool {
deadline := t.PublicationSubmissionDeadline()
return deadline > 0 && deadline > now
}
// IsRecommendable reports whether a tender should appear in customer AI recommendation results.
// Recommendations use the publication-based submission window, not tender_deadline.
func (t *Tender) IsRecommendable(now int64) bool {
@@ -287,11 +293,7 @@ func (t *Tender) IsRecommendable(now int64) bool {
case TenderStatusExpired, TenderStatusCancelled, TenderStatusAwarded, TenderStatusClosed:
return false
}
deadline := t.PublicationSubmissionDeadline()
if deadline <= 0 || deadline <= now {
return false
}
return true
return t.HasActivePublicationWindow(now)
}
// GetTenderURL returns the TED tender URL