Jump to content
Korean Random
Sign in to follow this  

Suggestion for sorting Carousel by Battles Played

Recommended Posts

Dear XVM Community,


Here is a small tweak to the carousel code in XVM that allows sorting of the carousel by battles played (battlecount). Would it be worth adding this as an XVM capability? Nothing is lost and the code is right here.






This mod allows the addition of “battlesCount” to sort criteria:




In the section:

if sort_criterion in ['winRate', 'markOfMastery']: 

                (down to just before elif statement)



Make this change

            if sort_criterion in ['winRate', 'markOfMastery', 'battlesCount']:

                itemsCache = dependency.instance(IItemsCache)

                vehicles_stats = itemsCache.items.getAccountDossier().getRandomStats().getVehicles() # battlesCount, wins, markOfMastery, xp

                stats = vehicles_stats.get(vehicle.intCD)

                comparisonKey.append(factor if stats else 0)

                if stats:

                    if sort_criterion == 'winRate':

                        comparisonKey.append(float(stats.wins) / stats.battlesCount * factor)

                    elif sort_criterion == 'markOfMastery':

                        comparisonKey.append(stats.markOfMastery * factor)

                    elif sort_criterion == 'battlesCount':

                        comparisonKey.append(stats.battlesCount * factor) 




This mod sorts the carousel by winrate or battles played




Set the sort order from:


     "sorting_criteria": ["nation", "type", "level"],


To one of the following:


     Games played low to high

     "sorting_criteria": ["battlesCount", "level"],


     Games played high to low

     "sorting_criteria": ["-battlesCount", "level"],


     Winrate High to Low

     "sorting_criteria": ["-winRate"],


     Winrate Low to High

     "sorting_criteria": ["winRate"],



Share this post

Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...