diff --git a/Makefile b/Makefile index ca113bc6b..9277ef51d 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ test_env_start: ## Start up backing services in test mode @docker-compose -f docker/test_env/docker-compose.yml up --remove-orphans -d test_env_rm: ## Stop and remove all test mode services - @docker-compose -f docker/standalone/docker-compose.yml down --remove-orphans --volumes + @docker-compose -f docker/test_env/docker-compose.yml down --remove-orphans --volumes standalone_run: ## Run standalone mode @docker-compose -f docker/standalone/docker-compose.yml up --remove-orphans diff --git a/caching/aggregates_cache.go b/caching/aggregates_cache.go index 52a7805c5..5bffc1ae9 100644 --- a/caching/aggregates_cache.go +++ b/caching/aggregates_cache.go @@ -525,6 +525,7 @@ func updateStatisticsCacheInfo(dbRunner *dbr.Session, transactionCache []models. fmt.Println("Error insert: ", err.Error()) } } + result = []models.StatisticsCache{} } } diff --git a/models/collections.go b/models/collections.go index 76ae0a223..d508ab32a 100644 --- a/models/collections.go +++ b/models/collections.go @@ -156,8 +156,8 @@ type CResult struct { type StatisticsStruct struct { HighestNumber float64 `json:"highestValue"` HighestDate string `json:"highestDate"` - LowestNumber float64 `json:"lowerValue"` - LowestDate string `json:"lowerDate"` + LowestNumber float64 `json:"lowestValue"` + LowestDate string `json:"lowestDate"` TxInfo interface{} `json:"txInfo"` } diff --git a/services/indexes/avax/reader_list_txs.go b/services/indexes/avax/reader_list_txs.go index 5b38f9d57..87ead79b1 100644 --- a/services/indexes/avax/reader_list_txs.go +++ b/services/indexes/avax/reader_list_txs.go @@ -832,7 +832,7 @@ func (r *Reader) GasUsedPerDay(ctx context.Context, p *params.ListParams) (model func (r *Reader) AvgGasPriceUsed(ctx context.Context, p *params.ListParams) (models.StatisticsStruct, error) { dbRunner, err := r.conns.DB().NewSession("avg_gas_price", cfg.RequestTimeout) if err != nil { - return models.StatisticsStruct{TxInfo: []models.TransactionsInfo{}}, err + return models.StatisticsStruct{TxInfo: []models.GasUsedPerDate{}}, err } var gasPrice []*models.GasUsedPerDate var statisticsStruct models.StatisticsStruct @@ -846,7 +846,7 @@ func (r *Reader) AvgGasPriceUsed(ctx context.Context, p *params.ListParams) (mod _, err = sa.LoadContext(ctx, &gasPrice) if err != nil { - return models.StatisticsStruct{TxInfo: []models.TransactionsInfo{}}, err + return models.StatisticsStruct{TxInfo: []models.GasUsedPerDate{}}, err } _, err = dbRunner.Select("date as highest_date", "gas as highest_number"). @@ -855,7 +855,7 @@ func (r *Reader) AvgGasPriceUsed(ctx context.Context, p *params.ListParams) (mod LoadContext(ctx, &statisticsStruct) if err != nil { - return models.StatisticsStruct{TxInfo: []models.TransactionsInfo{}}, err + return models.StatisticsStruct{TxInfo: []models.GasUsedPerDate{}}, err } _, err = dbRunner.Select("date as lowest_date", "gas as lowest_number"). @@ -864,7 +864,7 @@ func (r *Reader) AvgGasPriceUsed(ctx context.Context, p *params.ListParams) (mod LoadContext(ctx, &statisticsStruct) if err != nil || len(gasPrice) == 0 { - return models.StatisticsStruct{TxInfo: []models.TransactionsInfo{}}, err + return models.StatisticsStruct{TxInfo: []models.GasUsedPerDate{}}, err } statisticsStruct.TxInfo = gasPrice