In-line Portrait Generation
This commit is contained in:
@@ -16,7 +16,6 @@ import (
|
||||
)
|
||||
|
||||
const nullValue = "****"
|
||||
const internalPortraitModuleAuthoredKey = "__topdata_portrait_module_authored"
|
||||
|
||||
type nativeDataset struct {
|
||||
Kind nativeDatasetKind
|
||||
@@ -258,7 +257,7 @@ func buildNativeUnchecked(p *project.Project, progress func(string), prebuiltWik
|
||||
if err != nil {
|
||||
return BuildResult{}, err
|
||||
}
|
||||
collected, err = mergePortraitMetadata(collected)
|
||||
collected, err = mergeExpansionData(collected)
|
||||
if err != nil {
|
||||
return BuildResult{}, err
|
||||
}
|
||||
@@ -628,7 +627,7 @@ func collectBaseDataset(dataset nativeDataset) (nativeCollectedDataset, error) {
|
||||
}
|
||||
|
||||
nextID := nextAvailableID(usedIDs)
|
||||
applyModuleData := func(sourceLabel string, moduleData map[string]any, allowPortraitMetadataInjection bool) error {
|
||||
applyModuleData := func(sourceLabel string, moduleData map[string]any) error {
|
||||
if rawEntries, ok := moduleData["entries"]; ok {
|
||||
entries, ok := rawEntries.(map[string]any)
|
||||
if !ok {
|
||||
@@ -685,9 +684,6 @@ func collectBaseDataset(dataset nativeDataset) (nativeCollectedDataset, error) {
|
||||
}
|
||||
existing[field] = value
|
||||
}
|
||||
if allowPortraitMetadataInjection && rowHasPortraitMetadata(existing) {
|
||||
existing[internalPortraitModuleAuthoredKey] = true
|
||||
}
|
||||
continue
|
||||
}
|
||||
rowID, ok := lockData[key]
|
||||
@@ -705,9 +701,6 @@ func collectBaseDataset(dataset nativeDataset) (nativeCollectedDataset, error) {
|
||||
rows = append(rows, row)
|
||||
rowByID[rowID] = row
|
||||
rowByKey[key] = row
|
||||
if allowPortraitMetadataInjection && rowHasPortraitMetadata(row) {
|
||||
row[internalPortraitModuleAuthoredKey] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -813,9 +806,6 @@ func collectBaseDataset(dataset nativeDataset) (nativeCollectedDataset, error) {
|
||||
}
|
||||
row[field] = value
|
||||
}
|
||||
if allowPortraitMetadataInjection && rowHasPortraitMetadata(row) {
|
||||
row[internalPortraitModuleAuthoredKey] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -836,13 +826,13 @@ func collectBaseDataset(dataset nativeDataset) (nativeCollectedDataset, error) {
|
||||
}
|
||||
}
|
||||
for _, module := range generatedModules {
|
||||
if err := applyModuleData(module.Name, module.Data, false); err != nil {
|
||||
if err := applyModuleData(module.Name, module.Data); err != nil {
|
||||
return nativeCollectedDataset{}, err
|
||||
}
|
||||
}
|
||||
|
||||
for _, module := range moduleData {
|
||||
if err := applyModuleData(module.Name, module.Data, true); err != nil {
|
||||
if err := applyModuleData(module.Name, module.Data); err != nil {
|
||||
return nativeCollectedDataset{}, err
|
||||
}
|
||||
}
|
||||
@@ -850,7 +840,7 @@ func collectBaseDataset(dataset nativeDataset) (nativeCollectedDataset, error) {
|
||||
if !module.ApplyAfterModules {
|
||||
continue
|
||||
}
|
||||
if err := applyModuleData(module.Name, module.Data, false); err != nil {
|
||||
if err := applyModuleData(module.Name, module.Data); err != nil {
|
||||
return nativeCollectedDataset{}, err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user