fix: showing what core the chain is renewed on (#11256)

* fix: showing what core the chain is renewed on

* removed the code that is part of another pr

* better wording
This commit is contained in:
Daria 2025-02-06 00:36:10 +13:00 committed by GitHub
parent bf8346e569
commit e5b2b487fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,15 +132,21 @@ function useCoretimeInformationImpl (api: ApiPromise, ready: boolean): CoretimeI
const workloads = workloadData?.filter((one) => one.info.task === taskId);
const workTaskInfo = workloads.map((workload) => {
const workplan = workplans?.filter((workplan) => workplan.core === workload?.core && workplan.info.task.toString() === taskId);
// parachain can be renewed on a different core
const workplan = workplans?.filter((workplan) => workplan.info.task.toString() === taskId);
const type = getOccupancyType(lease, reservation, workload?.info.isPool ?? false);
const chainRenewedCore = type === CoreTimeTypes['Bulk Coretime'] && workplan?.find((a) => a.core === workload?.core);
const renewal = potentialRenewalsCurrentRegion?.find((renewal) => renewal.task.toString() === taskId);
const renewalStatus = chainRenewedCore ? ChainRenewalStatus.Renewed : renewal ? ChainRenewalStatus.Eligible : ChainRenewalStatus.None;
const potentialRenewal = potentialRenewalsCurrentRegion?.find((renewal) => renewal.task.toString() === taskId);
let renewalStatus = potentialRenewal ? ChainRenewalStatus.Eligible : ChainRenewalStatus.None;
const chainRenewedCore = type === CoreTimeTypes['Bulk Coretime'] && !!workplan?.length;
if (chainRenewedCore) {
renewalStatus = `Next cycle on core ${workplan[0].core}`;
}
return {
chainRenewedCore,
renewal,
renewal: potentialRenewal,
renewalStatus,
type,
workload,