Skip to content

Commit

Permalink
fix sql query to get iteration name on test run stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal-Delange committed Feb 17, 2025
1 parent 9dd632f commit e0bb817
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions repositories/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/checkmarble/marble-backend/utils"
"github.com/cockroachdb/errors"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"

"github.com/Masterminds/squirrel"
)
Expand Down Expand Up @@ -168,10 +169,14 @@ func (repo *MarbleDbRepository) SanctionCheckExecutionStats(
if err != nil {
return nil, err
}
sqlName := "SELECT name FROM sanction_check_configs WHERE scenario_iteration_id = $1"

sanctionCheckRuleName := "SELECT name FROM sanction_check_configs WHERE scenario_iteration_id = $1"
var name string
err = exec.QueryRow(ctx, sqlName, iterationId).Scan(&name)
if err != nil {
err = exec.QueryRow(ctx, sanctionCheckRuleName, iterationId).Scan(&name)
// All iterations don't have a sanction check config enabled. If there is none, just early exit
if errors.Is(err, pgx.ErrNoRows) {
return nil, nil
} else if err != nil {
return nil, err
}

Expand Down

0 comments on commit e0bb817

Please sign in to comment.