Skip to content

Commit

Permalink
1417-timestamp-UTC
Browse files Browse the repository at this point in the history
Signed-off-by: desmax74 <[email protected]>
  • Loading branch information
desmax74 committed Oct 27, 2023
1 parent 165897d commit 5cac233
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/assembler/backends/arangodb/certifyBad.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ func getCertifyBadFromCursor(ctx context.Context, cursor driver.Cursor) ([]*mode
Justification: createdValue.Justification,
Origin: createdValue.Collector,
Collector: createdValue.Origin,
KnownSince: createdValue.KnownSince,
KnownSince: createdValue.KnownSince.UTC(),
}

if pkg != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/assembler/backends/arangodb/certifyLegal.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ func (c *arangoClient) getCertifyLegalFromCursor(ctx context.Context,
DiscoveredLicense: createdValue.DiscoveredLicense,
Attribution: createdValue.Attribution,
Justification: createdValue.Justification,
TimeScanned: createdValue.TimeScanned,
TimeScanned: createdValue.TimeScanned.UTC(),
Origin: createdValue.Origin,
Collector: createdValue.Collector,
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/assembler/backends/arangodb/certifyVuln.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func setCertifyVulnMatchValues(arangoQueryBuilder *arangoQueryBuilder, certifyVu
}
if certifyVulnSpec.TimeScanned != nil {
arangoQueryBuilder.filter("certifyVuln", timeScannedStr, "==", "@"+timeScannedStr)
queryValues[timeScannedStr] = certifyVulnSpec.TimeScanned.UTC()
queryValues[timeScannedStr] = certifyVulnSpec.TimeScanned
}
if certifyVulnSpec.DbURI != nil {
arangoQueryBuilder.filter("certifyVuln", dbUriStr, "==", "@"+dbUriStr)
Expand Down
2 changes: 1 addition & 1 deletion pkg/assembler/backends/ent/backend/certify.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func upsertCertification[T certificationInputSpec](ctx context.Context, client *
SetJustification(v.Justification).
SetOrigin(v.Origin).
SetCollector(v.Collector).
SetKnownSince(v.KnownSince)
SetKnownSince(v.KnownSince.UTC())
case model.CertifyGoodInputSpec:
insert.
SetType(certification.TypeGOOD).
Expand Down
2 changes: 1 addition & 1 deletion pkg/assembler/backends/ent/backend/certifyLegal.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (b *EntBackend) IngestCertifyLegal(ctx context.Context, subject model.Packa
SetDiscoveredLicense(spec.DiscoveredLicense).
SetAttribution(spec.Attribution).
SetJustification(spec.Justification).
SetTimeScanned(spec.TimeScanned).
SetTimeScanned(spec.TimeScanned.UTC()).
SetOrigin(spec.Origin).
SetCollector(spec.Collector)

Expand Down
2 changes: 1 addition & 1 deletion pkg/assembler/backends/ent/backend/scorecard.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func toModelScorecard(record *ent.Scorecard) *model.Scorecard {
return &model.Scorecard{
Checks: record.Checks,
AggregateScore: record.AggregateScore,
TimeScanned: record.TimeScanned,
TimeScanned: record.TimeScanned.UTC(),
ScorecardVersion: record.ScorecardVersion,
ScorecardCommit: record.ScorecardCommit,
Origin: record.Origin,
Expand Down
2 changes: 1 addition & 1 deletion pkg/assembler/backends/inmem/certifyBad.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (c *demoClient) ingestCertifyBad(ctx context.Context, subject model.Package
}
if subjectMatch && certifyBad.Justification == v.justification &&
certifyBad.Origin == v.origin && certifyBad.Collector == v.collector &&
certifyBad.KnownSince.Equal(v.knownSince) {
certifyBad.KnownSince.UTC().Equal(v.knownSince.UTC()) {

collectedCertifyBadLink = *v
duplicate = true
Expand Down
4 changes: 2 additions & 2 deletions pkg/assembler/backends/inmem/certifyGood.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (c *demoClient) ingestCertifyGood(ctx context.Context, subject model.Packag
}
if subjectMatch && certifyGood.Justification == v.justification &&
certifyGood.Origin == v.origin && certifyGood.Collector == v.collector &&
certifyGood.KnownSince.Equal(v.knownSince) {
certifyGood.KnownSince.UTC().Equal(v.knownSince.UTC()) {

collectedCertifyGoodLink = *v
duplicate = true
Expand Down Expand Up @@ -292,7 +292,7 @@ func (c *demoClient) addCGIfMatch(out []*model.CertifyGood,
noMatch(filter.Collector, link.collector) ||
noMatch(filter.Collector, link.collector) ||
noMatch(filter.Origin, link.origin) ||
filter.KnownSince != nil && filter.KnownSince.After(link.knownSince) {
filter.KnownSince != nil && filter.KnownSince.UTC().After(link.knownSince.UTC()) {
return out, nil
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/assembler/backends/inmem/certifyLegal.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (c *demoClient) ingestCertifyLegal(ctx context.Context, subject model.Packa
cl.discoveredLicense == certifyLegal.DiscoveredLicense &&
slices.Equal(cl.discoveredLicenses, dis) &&
cl.attribution == certifyLegal.Attribution &&
cl.timeScanned.Equal(certifyLegal.TimeScanned) &&
cl.timeScanned.UTC().Equal(certifyLegal.TimeScanned.UTC()) &&
cl.justification == certifyLegal.Justification &&
cl.origin == certifyLegal.Origin &&
cl.collector == certifyLegal.Collector {
Expand Down Expand Up @@ -223,7 +223,7 @@ func (c *demoClient) convLegal(in *certifyLegalStruct) (*model.CertifyLegal, err
DiscoveredLicense: in.discoveredLicense,
Attribution: in.attribution,
Justification: in.justification,
TimeScanned: in.timeScanned,
TimeScanned: in.timeScanned.UTC(),
Origin: in.origin,
Collector: in.collector,
}
Expand Down Expand Up @@ -365,7 +365,7 @@ func (c *demoClient) addLegalIfMatch(out []*model.CertifyLegal,
noMatch(filter.Justification, link.justification) ||
noMatch(filter.Origin, link.origin) ||
noMatch(filter.Collector, link.collector) ||
(filter.TimeScanned != nil && !link.timeScanned.Equal(*filter.TimeScanned)) ||
(filter.TimeScanned != nil && !link.timeScanned.UTC().Equal(filter.TimeScanned.UTC())) ||
!c.matchLicenses(filter.DeclaredLicenses, link.declaredLicenses) ||
!c.matchLicenses(filter.DiscoveredLicenses, link.discoveredLicenses) {
return out, nil
Expand Down

0 comments on commit 5cac233

Please sign in to comment.