Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/gcpspanner/spanneradapters/web_features_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/GoogleChrome/webstatus.dev/lib/gcpspanner"
"github.com/GoogleChrome/webstatus.dev/lib/gen/jsonschema/web_platform_dx__web_features"
"github.com/GoogleChrome/webstatus.dev/lib/webdxfeaturetypes"
)

// WebFeatureSpannerClient expects a subset of the functionality from lib/gcpspanner that only apply to WebFeatures.
Expand Down Expand Up @@ -53,11 +54,11 @@ type WebFeaturesConsumer struct {

func (c *WebFeaturesConsumer) InsertWebFeatures(
ctx context.Context,
data map[string]web_platform_dx__web_features.FeatureValue,
data *webdxfeaturetypes.ProcessedWebFeaturesData,
startAt, endAt time.Time) (map[string]string, error) {
// 1. Prepare all WebFeature structs from the input data.
allFeatures := make([]gcpspanner.WebFeature, 0, len(data))
for featureID, featureData := range data {
allFeatures := make([]gcpspanner.WebFeature, 0, len(data.Features.Data))
for featureID, featureData := range data.Features.Data {
webFeature := gcpspanner.WebFeature{
FeatureKey: featureID,
Name: featureData.Name,
Expand All @@ -76,7 +77,7 @@ func (c *WebFeaturesConsumer) InsertWebFeatures(
}

// 3. Loop through the data again to process all related entities for each feature.
for featureID, featureData := range data {
for featureID, featureData := range data.Features.Data {
featureBaselineStatus := gcpspanner.FeatureBaselineStatus{
Status: getBaselineStatusEnum(featureData.Status),
LowDate: nil,
Expand Down
Loading