Skip to content

Commit c56c378

Browse files
committed
wip: save evaluated data
1 parent 943ebe7 commit c56c378

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

evaluator/evaluate.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,33 @@ func updateSystemPlatform(tx *gorm.DB, system *models.SystemPlatform,
608608
data["third_party"] = system.ThirdParty
609609
}
610610

611-
err := tx.Model(system).Updates(data).Error
611+
systemPatch := models.SystemPatch{
612+
SystemID: system.ID,
613+
RhAccountID: system.RhAccountID,
614+
}
615+
// err := tx.Model(system).Updates(data).Error
616+
err := tx.Model(&systemPatch).Updates(data).Error
617+
if enableAdvisoryAnalysis {
618+
system.InstallableAdvisoryCountCache = systemPatch.InstallableAdvisoryCountCache
619+
system.InstallableAdvisoryEnhCountCache = systemPatch.InstallableAdvisoryEnhCountCache
620+
system.InstallableAdvisoryBugCountCache = systemPatch.InstallableAdvisoryBugCountCache
621+
system.InstallableAdvisorySecCountCache = systemPatch.InstallableAdvisorySecCountCache
622+
623+
system.ApplicableAdvisoryCountCache = systemPatch.ApplicableAdvisoryCountCache
624+
system.ApplicableAdvisoryEnhCountCache = systemPatch.ApplicableAdvisoryEnhCountCache
625+
system.ApplicableAdvisoryBugCountCache = systemPatch.ApplicableAdvisoryBugCountCache
626+
system.ApplicableAdvisorySecCountCache = systemPatch.ApplicableAdvisorySecCountCache
627+
}
628+
629+
if enablePackageAnalysis {
630+
system.PackagesInstalled = systemPatch.PackagesInstalled
631+
system.PackagesInstallable = systemPatch.PackagesInstallable
632+
system.PackagesApplicable = systemPatch.PackagesApplicable
633+
}
634+
635+
if enableRepoAnalysis {
636+
system.ThirdParty = systemPatch.ThirdParty
637+
}
612638

613639
now := time.Now()
614640
if system.LastUpload != nil && system.LastUpload.Sub(now) > time.Hour {

listener/upload_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ func TestStoreOrUpdateSysPlatform(t *testing.T) {
400400

401401
// make sure we are not creating gaps in id sequences
402402
database.DB.Model(&models.SystemPlatform{}).Select("count(*)").Find(&newCount)
403-
database.DB.Raw("select currval('system_platform_id_seq')").Find(&currval)
403+
database.DB.Raw("select currval('system_inventory_id_seq')").Find(&currval)
404404
countInc := newCount - oldCount
405405
maxInc := currval - nextval
406406
assert.Equal(t, countInc, maxInc)

0 commit comments

Comments
 (0)