Skip to content

Commit 08ccc7a

Browse files
committed
Change to recommended rebalance threshold name
1 parent f78350b commit 08ccc7a

13 files changed

+99
-99
lines changed

api/services/benchmark/handler_createbenchmark.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ func (h *BenchmarkHandlerImpl) CreateBenchmark(c fiber.Ctx) error {
3131
benchmark, err := h.benchmarkStore.CreateBenchmark(
3232
c.Context(),
3333
&types.Benchmark{
34-
Name: benchmarkPayload.Name,
35-
Description: benchmarkPayload.Description,
36-
Asset_allocation: benchmarkPayload.Asset_allocation,
37-
Std_dev_pct: benchmarkPayload.Std_dev_pct,
38-
Real_return_pct: benchmarkPayload.Real_return_pct,
39-
Drawdown_yrs: benchmarkPayload.Drawdown_yrs,
40-
Rebalance_threshold_pct: benchmarkPayload.Rebalance_threshold_pct,
41-
Is_deprecated: benchmarkPayload.Is_deprecated,
42-
User_id: userPayload.User_id,
34+
Name: benchmarkPayload.Name,
35+
Description: benchmarkPayload.Description,
36+
Asset_allocation: benchmarkPayload.Asset_allocation,
37+
Std_dev_pct: benchmarkPayload.Std_dev_pct,
38+
Real_return_pct: benchmarkPayload.Real_return_pct,
39+
Drawdown_yrs: benchmarkPayload.Drawdown_yrs,
40+
Rec_rebalance_threshold_pct: benchmarkPayload.Rec_rebalance_threshold_pct,
41+
Is_deprecated: benchmarkPayload.Is_deprecated,
42+
User_id: userPayload.User_id,
4343
},
4444
)
4545

api/services/benchmark/schema_createbenchmark.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import (
88
)
99

1010
type CreateBenchmarkPayload struct {
11-
Name string `json:"name"`
12-
Description string `json:"description"`
13-
Asset_allocation []types.AssetAllocationPct `json:"asset_allocation"`
14-
Std_dev_pct float32 `json:"std_dev_pct"`
15-
Real_return_pct float32 `json:"real_return_pct"`
16-
Drawdown_yrs int `json:"drawdown_yrs"`
17-
Rebalance_threshold_pct int `json:"rebalance_threshold_pct"`
18-
Is_deprecated bool `json:"is_deprecated"`
11+
Name string `json:"name"`
12+
Description string `json:"description"`
13+
Asset_allocation []types.AssetAllocationPct `json:"asset_allocation"`
14+
Std_dev_pct float32 `json:"std_dev_pct"`
15+
Real_return_pct float32 `json:"real_return_pct"`
16+
Drawdown_yrs int `json:"drawdown_yrs"`
17+
Rec_rebalance_threshold_pct int `json:"rec_rebalance_threshold_pct"`
18+
Is_deprecated bool `json:"is_deprecated"`
1919
}
2020

2121
func (p CreateBenchmarkPayload) Validate() error {
@@ -43,7 +43,7 @@ func (p CreateBenchmarkPayload) Validate() error {
4343
validation.Field(&p.Std_dev_pct, validation.Min(float32(0)), validation.Max(float32(100))),
4444
validation.Field(&p.Real_return_pct, validation.Min(float32(0)), validation.Max(float32(100))),
4545
validation.Field(&p.Drawdown_yrs, validation.Min(0), validation.Max(50)),
46-
validation.Field(&p.Rebalance_threshold_pct, validation.Min(1), validation.Max(100)),
46+
validation.Field(&p.Rec_rebalance_threshold_pct, validation.Min(1), validation.Max(100)),
4747
validation.Field(&p.Is_deprecated),
4848
)
4949
}

api/services/benchmark/schema_updatebenchmark.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ func (p UpdateBenchmarkById) Validate() error {
1818
}
1919

2020
type UpdateBenchmarkPayload struct {
21-
Name string `json:"name"`
22-
Description string `json:"description"`
23-
Asset_allocation []types.AssetAllocationPct `json:"asset_allocation"`
24-
Std_dev_pct float32 `json:"std_dev_pct"`
25-
Real_return_pct float32 `json:"real_return_pct"`
26-
Drawdown_yrs int `json:"drawdown_yrs"`
27-
Rebalance_threshold_pct int `json:"rebalance_threshold_pct"`
28-
Is_deprecated bool `json:"is_deprecated"`
21+
Name string `json:"name"`
22+
Description string `json:"description"`
23+
Asset_allocation []types.AssetAllocationPct `json:"asset_allocation"`
24+
Std_dev_pct float32 `json:"std_dev_pct"`
25+
Real_return_pct float32 `json:"real_return_pct"`
26+
Drawdown_yrs int `json:"drawdown_yrs"`
27+
Rec_rebalance_threshold_pct int `json:"rec_rebalance_threshold_pct"`
28+
Is_deprecated bool `json:"is_deprecated"`
2929
}
3030

3131
func (p UpdateBenchmarkPayload) Validate() error {
@@ -53,7 +53,7 @@ func (p UpdateBenchmarkPayload) Validate() error {
5353
validation.Field(&p.Std_dev_pct, validation.Min(float32(0)), validation.Max(float32(100))),
5454
validation.Field(&p.Real_return_pct, validation.Min(float32(0)), validation.Max(float32(100))),
5555
validation.Field(&p.Drawdown_yrs, validation.Min(0), validation.Max(50)),
56-
validation.Field(&p.Rebalance_threshold_pct, validation.Min(1), validation.Max(100)),
56+
validation.Field(&p.Rec_rebalance_threshold_pct, validation.Min(1), validation.Max(100)),
5757
validation.Field(&p.Is_deprecated),
5858
)
5959
}

api/services/benchmark/store_createbenchmark.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +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
19+
var rec_rebalance_threshold_pct int = b.Rec_rebalance_threshold_pct
20+
if b.Rec_rebalance_threshold_pct == 0 {
21+
rec_rebalance_threshold_pct = constants.BENCHMARK_REBALANCE_PCT_DEFAULT
2222
}
2323

2424
row := s.db.QueryRow(
2525
c,
2626
`INSERT INTO benchmarks
27-
(name, description, asset_allocation, std_dev_pct, real_return_pct, drawdown_yrs, is_deprecated, user_id, rebalance_threshold_pct)
27+
(name, description, asset_allocation, std_dev_pct, real_return_pct, drawdown_yrs, is_deprecated, user_id, rec_rebalance_threshold_pct)
2828
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
2929
RETURNING *`,
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,
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, rec_rebalance_threshold_pct,
3131
)
3232

3333
benchmark, err := s.parseRowIntoBenchmark(row)

api/services/benchmark/store_getbenchmarkbyid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (s *PostgresBenchmarkStore) parseRowIntoBenchmark(row pgx.Row) (types.Bench
4949
&b.User_id,
5050
&b.Created_at,
5151
&b.Updated_at,
52-
&b.Rebalance_threshold_pct,
52+
&b.Rec_rebalance_threshold_pct,
5353
)
5454

5555
if err != nil {

api/services/benchmark/store_getbenchmarks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (s *PostgresBenchmarkStore) parseRowsIntoBenchmarks(rows pgx.Rows) ([]types
103103
&b.User_id,
104104
&b.Created_at,
105105
&b.Updated_at,
106-
&b.Rebalance_threshold_pct,
106+
&b.Rec_rebalance_threshold_pct,
107107
&total_items,
108108
)
109109

api/services/benchmark/store_updatebenchmark.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (s *PostgresBenchmarkStore) UpdateBenchmark(ctx context.Context, b *types.B
2929
real_return_pct = $5,
3030
drawdown_yrs = $6,
3131
is_deprecated = $7,
32-
rebalance_threshold_pct = $10,
32+
rec_rebalance_threshold_pct = $10,
3333
updated_at = now()
3434
where
3535
benchmark_id = $8
@@ -46,7 +46,7 @@ func (s *PostgresBenchmarkStore) UpdateBenchmark(ctx context.Context, b *types.B
4646
b.Is_deprecated,
4747
b.Benchmark_id,
4848
b.User_id,
49-
b.Rebalance_threshold_pct,
49+
b.Rec_rebalance_threshold_pct,
5050
)
5151

5252
benchmark, err := s.parseRowIntoBenchmark(row)

api/types/benchmark.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ type AssetAllocationPct struct {
1313
}
1414

1515
type Benchmark struct {
16-
Benchmark_id int `json:"benchmark_id"`
17-
Name string `json:"name"`
18-
Description string `json:"description"`
19-
Asset_allocation []AssetAllocationPct `json:"asset_allocation"`
20-
Std_dev_pct float32 `json:"std_dev_pct"`
21-
Real_return_pct float32 `json:"real_return_pct"`
22-
Drawdown_yrs int `json:"drawdown_yrs"`
23-
Rebalance_threshold_pct int `json:"rebalance_threshold_pct"`
24-
Is_deprecated bool `json:"is_deprecated"`
25-
User_id int `json:"user_id"`
26-
Created_at time.Time `json:"created_at"`
27-
Updated_at time.Time `json:"updated_at"`
16+
Benchmark_id int `json:"benchmark_id"`
17+
Name string `json:"name"`
18+
Description string `json:"description"`
19+
Asset_allocation []AssetAllocationPct `json:"asset_allocation"`
20+
Std_dev_pct float32 `json:"std_dev_pct"`
21+
Real_return_pct float32 `json:"real_return_pct"`
22+
Drawdown_yrs int `json:"drawdown_yrs"`
23+
Rec_rebalance_threshold_pct int `json:"rec_rebalance_threshold_pct"`
24+
Is_deprecated bool `json:"is_deprecated"`
25+
User_id int `json:"user_id"`
26+
Created_at time.Time `json:"created_at"`
27+
Updated_at time.Time `json:"updated_at"`
2828
}
2929

3030
type BenchmarkHandler interface {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ALTER TABLE benchmarks DROP COLUMN rebalance_threshold_pct;
1+
ALTER TABLE benchmarks DROP COLUMN rec_rebalance_threshold_pct;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ALTER TABLE benchmarks ADD COLUMN rebalance_threshold_pct integer DEFAULT 10;
1+
ALTER TABLE benchmarks ADD COLUMN rec_rebalance_threshold_pct integer DEFAULT 10;

0 commit comments

Comments
 (0)