@@ -16,13 +16,18 @@ func (s *PostgresBenchmarkStore) CreateBenchmark(ctx context.Context, b *types.B
1616 return types.Benchmark {}, errors .New ("service error: benchmark struct cannot be nil, valid benchmark data is required" )
1717 }
1818
19+ var rebalance_threshold_pct int = b .Rebalance_threshold_pct
20+ if b .Rebalance_threshold_pct == 0 {
21+ rebalance_threshold_pct = constants .BENCHMARK_REBALANCE_PCT_DEFAULT
22+ }
23+
1924 row := s .db .QueryRow (
2025 c ,
2126 `INSERT INTO benchmarks
22- (name, description, asset_allocation, std_dev_pct, real_return_pct, drawdown_yrs, is_deprecated, user_id)
23- VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
27+ (name, description, asset_allocation, std_dev_pct, real_return_pct, drawdown_yrs, is_deprecated, user_id, rebalance_threshold_pct )
28+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9 )
2429 RETURNING *` ,
25- b .Name , b .Description , b .Asset_allocation , b .Std_dev_pct , b .Real_return_pct , b .Drawdown_yrs , b .Is_deprecated , b .User_id ,
30+ b .Name , b .Description , b .Asset_allocation , b .Std_dev_pct , b .Real_return_pct , b .Drawdown_yrs , b .Is_deprecated , b .User_id , rebalance_threshold_pct ,
2631 )
2732
2833 benchmark , err := s .parseRowIntoBenchmark (row )
0 commit comments