Skip to content

Commit

Permalink
Merge pull request #180 from Koniverse/koni/dev/isue-278
Browse files Browse the repository at this point in the history
[issue-278] Mythical Telegram App - Error not showing card with Power > 110 when filtering
  • Loading branch information
lw-cdm authored Jan 15, 2025
2 parents 3ab91a0 + 7ff2e82 commit ae33335
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import { MythButton } from '@subwallet/extension-koni-ui/components/Mythical';
import { NFLRivalCard } from '@subwallet/extension-koni-ui/connector/booka/types';
import { MaxLevelOptionId, MaxPowerOptionId } from '@subwallet/extension-koni-ui/constants';
import { ConditionProcessState } from '@subwallet/extension-koni-ui/Popup/Home/Cards';
import { FilterItems, FilterOption } from '@subwallet/extension-koni-ui/Popup/Home/Cards/ToolFiters/index';
import { ThemeProps } from '@subwallet/extension-koni-ui/types';
Expand Down Expand Up @@ -99,13 +100,13 @@ const Component = ({ className, filterItems, handleCancel, handleReset, onConfir
let isCardLevelPassed = tmpItemsSelected[FilterOption.LEVEL_OPTION].length === 0;

if (!isCardPowerPassed) {
const idx = Math.floor((card.power - 50 >= 0 ? card.power - 50 : 0) / 10);
const idx = Math.min(Math.floor((card.power - 50 >= 0 ? card.power - 50 : 0) / 10), MaxPowerOptionId);

isCardPowerPassed = tmpItemsSelected[FilterOption.POWER_OPTION].includes(idx.toString());
}

if (!isCardLevelPassed) {
const idx = Math.floor(card.level / 5);
const idx = Math.min(Math.floor(card.level / 5), MaxLevelOptionId);

isCardLevelPassed = tmpItemsSelected[FilterOption.LEVEL_OPTION].includes(idx.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ export const RarityOptions = [
{ id: 'mythical', label: 'Mythical' }
];

/*
Apply the formula to determine the ID of the list of options to determine the selected option.
Since the previous options were built based on value ranges that have the same cycle, to cover the range of remaining attribute values,
it is necessary to use MaxId to round up to the largest ID in case the remaining attribute values do not follow the cycle."
*/
export const MaxPowerOptionId = 5;
export const PowerOptions = [
{ id: '0', label: '<60' },
{ id: '1', label: '60-69' },
Expand All @@ -107,6 +113,7 @@ export const PowerOptions = [
{ id: '5', label: '100+' }
];

export const MaxLevelOptionId = 4;
export const LevelOptions = [
{ id: '0', label: '≥1' },
{ id: '1', label: '≥5' },
Expand Down

0 comments on commit ae33335

Please sign in to comment.