From f294cdcc5770350e994cd8409c89c346051565ef Mon Sep 17 00:00:00 2001 From: xinran chen Date: Wed, 12 Jul 2023 00:06:04 +0800 Subject: [PATCH] some modify --- miner-api/controller/controller.go | 1 - miner-api/internal/orm/prover_task.go | 2 +- miner-api/test/prover_task_test.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/miner-api/controller/controller.go b/miner-api/controller/controller.go index 4526ef86c5..66f3778479 100644 --- a/miner-api/controller/controller.go +++ b/miner-api/controller/controller.go @@ -88,5 +88,4 @@ func (c *ProverTaskController) GetTask(ctx *gin.Context) { return } ctx.JSON(http.StatusOK, task) - } diff --git a/miner-api/internal/orm/prover_task.go b/miner-api/internal/orm/prover_task.go index 0be0990f0c..08633614c2 100644 --- a/miner-api/internal/orm/prover_task.go +++ b/miner-api/internal/orm/prover_task.go @@ -63,7 +63,7 @@ func (o *ProverTask) GetProverTasksByHashes(ctx context.Context, hashes []string func (o *ProverTask) GetProverTasksByProver(ctx context.Context, pubkey string) ([]*ProverTask, error) { var proverTasks []*ProverTask - err := o.db.WithContext(ctx).Model(&ProverTask{}).Where(&ProverTask{ProverPublicKey: pubkey}).Order("id asc").Find(&proverTasks).Error + err := o.db.WithContext(ctx).Model(&ProverTask{}).Where(&ProverTask{ProverPublicKey: pubkey}).Order("created_at asc").Find(&proverTasks).Error if err != nil { return nil, fmt.Errorf("ProverTask.GetProverTasksByProver error: %w, prover %s", err, pubkey) } diff --git a/miner-api/test/prover_task_test.go b/miner-api/test/prover_task_test.go index dc94758ee5..d1edbef1de 100644 --- a/miner-api/test/prover_task_test.go +++ b/miner-api/test/prover_task_test.go @@ -66,7 +66,7 @@ func testGetProverTasksByProver(t *testing.T) { } func testGetTotalRewards(t *testing.T) { - rewards := make(map[string]uint64) + rewards := make(map[string]decimal.Decimal) getResp(t, fmt.Sprintf("%s/total_rewards?pubkey=%s", basicPath, proverPubkey), &rewards) assert.Equal(t, decimal.NewFromInt(22), rewards["rewards"]) }