Skip to content

Commit

Permalink
chore: Statistics card data
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaaraly committed Jul 4, 2022
1 parent 0916340 commit ed604a9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
21 changes: 21 additions & 0 deletions analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
def findByAttr(cards, value, attr='name'):
lists = list(filter(lambda x: x[attr] == value, cards))
return lists


def summary(cards):

total = len(cards)
rarity_5 = findByAttr(cards, 5, 'rarity')
rarity_4 = findByAttr(cards, 4, 'rarity')

print('Total: ', total)
print('6🌟: ', len(rarity_5), ',They are:\n', get_name(rarity_5))
print('5🌟: ', len(rarity_4), ',They are:\n', get_name(rarity_4))
print('\n\n')

# return total / len(rarity_5)


def get_name(cards):
return list(map(lambda x: x['name'], cards))
8 changes: 7 additions & 1 deletion arkspider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from login import token_api, login
from cards import convert_cards
from analysis import summary
from config import Config, persist, read_data


Expand Down Expand Up @@ -48,7 +49,12 @@ def run():
token = token_api(cookie)
cards = convert_cards(token)

print(list(filter(lambda x: x['rarity'] == 5, cards)))
# print('Total 6🌟 cards: ', byRarity(cards))
# per = summary(cards)
# questionary.print(
# 'On average, one six-star character is drawn for every '+ str(per),
# style='italic green')
summary(cards)


if __name__ == '__main__':
Expand Down

0 comments on commit ed604a9

Please sign in to comment.