diff --git a/pages/api/v1/deals.js b/pages/api/v1/deals.js index d726a0a3..88b72aa6 100644 --- a/pages/api/v1/deals.js +++ b/pages/api/v1/deals.js @@ -31,6 +31,15 @@ export default async (req, res) => { totals.costFormatted = Strings.formatAsFilecoinConversion(totals.cost); totals.sizeFormatted = Strings.bytesToSize(totals.size); + totals.averages = { + costPerDealFIL: Strings.formatAsFilecoinConversion(totals.cost / totals.deals), + costPerDealAttoFIL: totals.cost / totals.deals, + sizePerDealBytes: totals.size / totals.deals, + sizePerDealBytesFormatted: Strings.bytesToSize(totals.size / totals.deals), + costPerByteAttoFIL: totals.cost / totals.size, + costPerByteFIL: Strings.formatAsFilecoinConversion(totals.cost / totals.size), + costPerGBFIL: Strings.formatAsFilecoinConversion((totals.cost / totals.size) * 1073741824), + }; if (!response) { return res.status(500).send({ diff --git a/scripts/worker-heavy-stones.js b/scripts/worker-heavy-stones.js index 40a2cf3f..e4565966 100644 --- a/scripts/worker-heavy-stones.js +++ b/scripts/worker-heavy-stones.js @@ -56,7 +56,7 @@ const run = async () => { Logs.taskTimeless(`Fetching every user ...`); const response = await Data.getEveryUser(false); - const storageUsers = []; + let storageUsers = []; const writable = []; const slateAddresses = []; let bytes = 0; @@ -69,7 +69,7 @@ const run = async () => { const user = response[i]; if (user.data.allow_automatic_data_storage) { - storageUsers.push(user); + storageUsers.unshift(user); dealUsers = dealUsers + 1; }