Start and end dates are now the contract's, with a new closing date
Find a Tender never sends tender.tenderPeriod.startDate, so an opportunity's start date was always empty, and its end date was the bid deadline. Start and end are now the contract period: from the contracts' periods, else the awards' contract periods, else the lots' contract periods, each date on its own, taking the earliest start and the latest end of several. The bid deadline (tenderPeriod.endDate) moves to a new closing_date column (migration 00009), in the API as closing_date. EU Supply's pages give no contract period, so its start and end are left empty and its response deadline is the closing date.
This commit is contained in:
1 parent
43f9ef3223
commit
50ee510520
9 files changed
+191
-27
No files matched your search
@@ -0,0 +1,11 @@
|
||||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
-- When bids must be in by (the tender period's end). start_date and
|
||||
-- end_date are the contract period.
|
||||
ALTER TABLE "opportunities" ADD COLUMN "closing_date" DATETIME;
|
||||
-- +goose StatementEnd
|
||||
|
||||
-- +goose Down
|
||||
-- +goose StatementBegin
|
||||
ALTER TABLE "opportunities" DROP COLUMN "closing_date";
|
||||
-- +goose StatementEnd
|
||||
@@ -42,13 +42,13 @@ const upsertOpportunity = `
|
||||
INSERT INTO opportunities (
|
||||
uuid, uuid_type, title, status, description, buyer_name, buyer_id,
|
||||
main_category, procurement_method, multi_lot, sme_suitable,
|
||||
vcse_suitable, start_date, end_date, gross_value, has_documents, source,
|
||||
latest_release_date
|
||||
vcse_suitable, start_date, end_date, closing_date, gross_value,
|
||||
has_documents, source, latest_release_date
|
||||
) VALUES (
|
||||
:uuid, :uuid_type, :title, :status, :description, :buyer_name, :buyer_id,
|
||||
:main_category, :procurement_method, :multi_lot, :sme_suitable,
|
||||
:vcse_suitable, :start_date, :end_date, :gross_value, :has_documents,
|
||||
:source, :latest_release_date
|
||||
:vcse_suitable, :start_date, :end_date, :closing_date, :gross_value,
|
||||
:has_documents, :source, :latest_release_date
|
||||
)
|
||||
ON CONFLICT (uuid) DO UPDATE SET
|
||||
uuid_type = excluded.uuid_type,
|
||||
@@ -64,6 +64,7 @@ ON CONFLICT (uuid) DO UPDATE SET
|
||||
vcse_suitable = excluded.vcse_suitable,
|
||||
start_date = excluded.start_date,
|
||||
end_date = excluded.end_date,
|
||||
closing_date = excluded.closing_date,
|
||||
gross_value = excluded.gross_value,
|
||||
has_documents = excluded.has_documents,
|
||||
source = excluded.source,
|
||||
|
||||
@@ -192,6 +192,7 @@ func prepareOpportunity(opportunity *types.Opportunity) error {
|
||||
opportunity.LatestReleaseDate = latest.UTC()
|
||||
opportunity.StartDate = utcPtr(opportunity.StartDate)
|
||||
opportunity.EndDate = utcPtr(opportunity.EndDate)
|
||||
opportunity.ClosingDate = utcPtr(opportunity.ClosingDate)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func opportunity(
|
||||
releaseDay int,
|
||||
releaseIDs ...string,
|
||||
) *types.Opportunity {
|
||||
start, end := day(20), day(28)
|
||||
start, end, closing := day(20), day(28), day(15)
|
||||
t := &types.Opportunity{
|
||||
UUID: uuid,
|
||||
UUIDType: "ocid",
|
||||
@@ -52,6 +52,7 @@ func opportunity(
|
||||
SMESuitable: true,
|
||||
StartDate: &start,
|
||||
EndDate: &end,
|
||||
ClosingDate: &closing,
|
||||
GrossValue: 125000.50,
|
||||
HasDocuments: true,
|
||||
Source: "FindATender",
|
||||
@@ -144,8 +145,11 @@ func TestSaveAndGetRoundTrip(t *testing.T) {
|
||||
t.Errorf("opportunity fields differ:\n got %+v\nwant %+v", got, in)
|
||||
}
|
||||
if got.StartDate == nil || !got.StartDate.Equal(day(20)) ||
|
||||
got.EndDate == nil || !got.EndDate.Equal(day(28)) {
|
||||
t.Errorf("dates: got %v / %v", got.StartDate, got.EndDate)
|
||||
got.EndDate == nil || !got.EndDate.Equal(day(28)) ||
|
||||
got.ClosingDate == nil || !got.ClosingDate.Equal(day(15)) {
|
||||
t.Errorf(
|
||||
"dates: got %v / %v / %v", got.StartDate, got.EndDate, got.ClosingDate,
|
||||
)
|
||||
}
|
||||
if want := day(1).Add(time.Minute); !got.LatestReleaseDate.Equal(want) {
|
||||
t.Errorf("LatestReleaseDate = %v, want %v", got.LatestReleaseDate, want)
|
||||
@@ -188,11 +192,14 @@ func TestSaveAndGetRoundTrip(t *testing.T) {
|
||||
func TestStartAndEndDateMayBeNil(t *testing.T) {
|
||||
s := openStore(t)
|
||||
in := opportunity("ocds-1", "No dates", 1, "r1")
|
||||
in.StartDate, in.EndDate = nil, nil
|
||||
in.StartDate, in.EndDate, in.ClosingDate = nil, nil, nil
|
||||
mustSave(t, s, in)
|
||||
got := mustGet(t, s, "ocds-1")
|
||||
if got.StartDate != nil || got.EndDate != nil {
|
||||
t.Errorf("got %v / %v, want nil", got.StartDate, got.EndDate)
|
||||
if got.StartDate != nil || got.EndDate != nil || got.ClosingDate != nil {
|
||||
t.Errorf(
|
||||
"got %v / %v / %v, want nil",
|
||||
got.StartDate, got.EndDate, got.ClosingDate,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user