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
+44
View File
@@ -88,6 +88,50 @@ func TestTenderPublicationSubmissionDeadline(t *testing.T) {
}
}
func TestTenderHasActivePublicationWindow(t *testing.T) {
now := int64(1_700_000_000)
tests := []struct {
name string
tender Tender
want bool
}{
{
name: "future submission deadline",
tender: Tender{SubmissionDeadline: now + 3600},
want: true,
},
{
name: "past submission deadline",
tender: Tender{SubmissionDeadline: now - 3600},
want: false,
},
{
name: "future tender deadline only",
tender: Tender{TenderDeadline: now + 86400},
want: false,
},
{
name: "publication date only with open window",
tender: Tender{PublicationDate: now - 3600},
want: true,
},
{
name: "no publication or submission deadline",
tender: Tender{},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := tt.tender.HasActivePublicationWindow(now); got != tt.want {
t.Fatalf("HasActivePublicationWindow() = %v, want %v", got, tt.want)
}
})
}
}
func TestTenderIsRecommendable(t *testing.T) {
now := int64(1_700_000_000)