tender duplication fix
This commit is contained in:
+36
-4
@@ -138,8 +138,9 @@ func (s *TEDScraper) mapToTender(cn *ContractNotice, sourceFileURL, sourceFileNa
|
||||
now := time.Now().Unix()
|
||||
|
||||
t := ¬ice.Notice{
|
||||
ContractNoticeID: cn.ID,
|
||||
ContractFolderID: cn.ContractFolderID,
|
||||
ContractNoticeID: cn.ID,
|
||||
ContractFolderID: cn.ContractFolderID,
|
||||
ProcurementProjectID: procurementProjectIDFromContractNotice(cn),
|
||||
NoticeTypeCode: strings.TrimSpace(cn.GetNoticeType()),
|
||||
FormType: cn.GetNoticeFormType(),
|
||||
NoticeSubTypeCode: cn.GetNoticeSubType(),
|
||||
@@ -297,8 +298,9 @@ func (s *TEDScraper) mapContractAwardNoticeToTender(can *ContractAwardNotice, so
|
||||
now := time.Now().Unix()
|
||||
|
||||
t := ¬ice.Notice{
|
||||
ContractNoticeID: can.ID,
|
||||
ContractFolderID: can.ContractFolderID,
|
||||
ContractNoticeID: can.ID,
|
||||
ContractFolderID: can.ContractFolderID,
|
||||
ProcurementProjectID: procurementProjectIDFromContractAwardNotice(can),
|
||||
NoticeTypeCode: strings.TrimSpace(can.GetNoticeType()),
|
||||
FormType: can.GetNoticeFormType(),
|
||||
NoticeSubTypeCode: can.GetNoticeSubType(),
|
||||
@@ -428,6 +430,36 @@ func (s *TEDScraper) mapContractAwardNoticeToTender(can *ContractAwardNotice, so
|
||||
return t
|
||||
}
|
||||
|
||||
func procurementProjectIDFromContractNotice(cn *ContractNotice) string {
|
||||
if cn == nil {
|
||||
return ""
|
||||
}
|
||||
if cn.ProcurementProject != nil {
|
||||
if id := strings.TrimSpace(cn.ProcurementProject.ID); id != "" {
|
||||
return id
|
||||
}
|
||||
}
|
||||
if lot := cn.firstLot(); lot != nil && lot.ProcurementProject != nil {
|
||||
return strings.TrimSpace(lot.ProcurementProject.ID)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func procurementProjectIDFromContractAwardNotice(can *ContractAwardNotice) string {
|
||||
if can == nil {
|
||||
return ""
|
||||
}
|
||||
if can.ProcurementProject != nil {
|
||||
if id := strings.TrimSpace(can.ProcurementProject.ID); id != "" {
|
||||
return id
|
||||
}
|
||||
}
|
||||
if lot := can.firstAwardLot(); lot != nil && lot.ProcurementProject != nil {
|
||||
return strings.TrimSpace(lot.ProcurementProject.ID)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// mapOrganization maps a TED Organization to tender Organization
|
||||
func (s *TEDScraper) mapOrganization(tedOrg *Organization, role string) *notice.Organization {
|
||||
if tedOrg == nil || tedOrg.Company == nil {
|
||||
|
||||
Reference in New Issue
Block a user