Skip to content

Commit 6ea4e97

Browse files
authored
Merge pull request #14 from libremfg/change/uom-update
Change UoM upsert
2 parents 0dfe8ec + eb55d55 commit 6ea4e97

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ $ ./rhize-importer.exe equipment \
115115
This project is licensed under the MIT License - see the LICENSE file for details.
116116
117117
## Change log
118+
- v1.8.1 J.W.
119+
- Change Units of Measure to upsert instead of failing if same Unit of Measure already exists
118120
- v1.8.0 J.W.
119121
- Add support for including expressions with tag bindings, pulling from a dedicated column
120122
- v1.7.0 J.W.

commands/unitOfMeasure.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ out:
6666
log.Printf("\tcould not query unit of measure: %s", err.Error())
6767
continue out
6868
}
69+
operation := "Adding"
6970
if existingUoM != nil {
70-
log.Printf("\tUnit of Measure %s already exists, skipping", uom)
71-
continue out
71+
operation = "Updating"
7272
}
7373

74-
log.Printf("\tAdding UoM for %s", uom)
74+
log.Printf("\t%s UoM for %s", operation, uom)
7575
err = types.CreateUnitOfMeasure(ctx, client, []domain.AddUnitOfMeasureInput{unit})
7676
if err != nil {
7777
log.Printf("\tcould not add unit of measure: %s", err.Error())

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/joho/godotenv"
1010
)
1111

12-
const versionString = "rhize-data-collection-import v1.8.0"
12+
const versionString = "rhize-data-collection-import v1.8.1"
1313

1414
func main() {
1515
log.Println(versionString)

types/unitOfMeasure.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func CreateUnitOfMeasure(ctx context.Context, client *graphql.Client, input []do
4545
ID string `graphql:"id"`
4646
DataType string `graphql:"dataType"`
4747
} `graphql:"unitOfMeasure"`
48-
} `graphql:"addUnitOfMeasure(input: $uom)"`
48+
} `graphql:"addUnitOfMeasure(input: $uom, upsert: true)"`
4949
}
5050

5151
reqVar := map[string]interface{}{

0 commit comments

Comments
 (0)