Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/MiningCore/Api/ApiServer.cs
#	src/MiningCore/Api/Extensions/MiningPoolExtensions.cs
  • Loading branch information
Oliver Weichhold committed Jan 10, 2018
2 parents 23d4e75 + 35ff58a commit 2586764
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/MiningCore/Api/ApiServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,11 @@ private async Task GetPoolInfosAsync(HttpContext context, Match m)
{
Pools = clusterConfig.Pools.Select(config =>
{
var result = config.ToPoolInfo(mapper);

// load stats
var stats = cf.Run(con => statsRepo.GetLastPoolStats(con, config.Id));

// map
result.PoolStats = mapper.Map<Mining.PoolStats>(stats);
result.NetworkStats = mapper.Map<BlockchainStats>(stats);
var result = config.ToPoolInfo(mapper, stats);

// enrich
#if DEBUG
Expand All @@ -253,9 +250,12 @@ private async Task GetPoolInfoAsync(HttpContext context, Match m)
if (pool == null)
return;

var response = new GetPoolResponse()
// load stats
var stats = cf.Run(con => statsRepo.GetLastPoolStats(con, pool.Id));

var response = new GetPoolResponse
{
Pool = pool.ToPoolInfo(mapper)
Pool = pool.ToPoolInfo(mapper, stats)
};

// enrich
Expand Down
5 changes: 4 additions & 1 deletion src/MiningCore/Api/Extensions/MiningPoolExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ namespace MiningCore.Api.Extensions
{
public static class MiningPoolExtensions
{
public static PoolInfo ToPoolInfo(this PoolConfig pool, IMapper mapper)
public static PoolInfo ToPoolInfo(this PoolConfig pool, IMapper mapper, Persistence.Model.PoolStats stats)
{
var poolInfo = mapper.Map<PoolInfo>(pool);

poolInfo.PoolStats = mapper.Map<PoolStats>(stats);
poolInfo.NetworkStats = mapper.Map<BlockchainStats>(stats);

// pool wallet link
CoinMetaData.AddressInfoLinks.TryGetValue(pool.Coin.Type, out var addressInfobaseUrl);
if (!string.IsNullOrEmpty(addressInfobaseUrl))
Expand Down

0 comments on commit 2586764

Please sign in to comment.