Skip to content

Commit

Permalink
Merge pull request #110 from buchhalter-ai/send-oicdbVersion-as-metric
Browse files Browse the repository at this point in the history
`sync` cmd: Fix bug where oicdbVersion is sent as empty string as metric
  • Loading branch information
brgmn authored Sep 17, 2024
2 parents 308bf05 + 89ec5ca commit 51bcaaf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,6 @@ func runSyncCommandLogic(p *tea.Program, logger *slog.Logger, config *syncComman
Completed: true,
})

p.Send(buchhalterMetricsRecord{
CliVersion: cliVersion,
VaultVersion: vaultProvider.Version,
OicdbVersion: recipeParser.OicdbVersion,
})

p.Send(utils.ViewStatusUpdateMsg{Message: "Building archive index"})
logger.Info("Building document archive index ...")

Expand Down Expand Up @@ -280,6 +274,13 @@ func runSyncCommandLogic(p *tea.Program, logger *slog.Logger, config *syncComman
return
}

// At this point in time, we have all the information we need to send metrics
p.Send(buchhalterMetricsRecord{
CliVersion: cliVersion,
VaultVersion: vaultProvider.Version,
OicdbVersion: recipeParser.OicdbVersion,
})

// No pair of credentials found for supplier/recipes
if len(recipesToExecute) == 0 {
loggingErrorMessage := "No recipes found for suppliers"
Expand All @@ -293,6 +294,7 @@ func runSyncCommandLogic(p *tea.Program, logger *slog.Logger, config *syncComman
})
return
}
statusUpdateMessage = fmt.Sprintf("%s (OICDB %s)", statusUpdateMessage, recipeParser.OicdbVersion)
p.Send(utils.ViewStatusUpdateMsg{
Message: statusUpdateMessage,
Completed: true,
Expand Down Expand Up @@ -932,8 +934,6 @@ func (m viewModelSync) View() string {
textStyle("More information at: "),
textStyleBold("https://buchhalter.ai"),
textStyleGrayBold(fmt.Sprintf("Using CLI %s", cliVersion)),
// TODO Outputting OICDB as task
//textStyleGrayBold(fmt.Sprintf("Using OICDB %s and CLI %s", m.recipeParser.OicdbVersion, cliVersion)),
) + "\n")

for _, actionCompleted := range m.actionsCompleted {
Expand Down

0 comments on commit 51bcaaf

Please sign in to comment.