Force-of-Wind / fowsim

Force of Will Online Simulator
GNU Affero General Public License v3.0
9 stars 6 forks source link

Add filtering to metrics #165

Open edmundchan8 opened 4 months ago

edmundchan8 commented 4 months ago

https://www.forceofwind.online/metrics

Currently, metrics page provides the most recently used cards over x time period. This also includes data regarding most picked cards based only on Will attribute, only on will cost, card type etc.

Request to filter this further, for example, have the metrics page display all the same data, but based on Wind will only, or based on Wind will and if the card type is 'Resonator'

Could be related to how the metrics function within views.py handles the card picks https://github.com/Force-of-Wind/fowsim/blob/main/cardDatabase/views.py

Metrics related to / calculated by dailyDeckMetricCalculations.py script

blocker - how to recreate metrics data in local? - Possible solution, don't, just create fake data and use that as 'metrics'

could go to views.py file, replace the data for 'most_picked_cards' to Card.objects.filter(get_set_query(['MOA']) & Q(rarity='R')),

e.g.

views.py

def metrics(request):
    ctx = {
        'most_picked_cards':Card.objects.filter(get_set_query(['MOA']) & Q(rarity='R')),

modify the metrics.html to view the cards above (from set MOA, rarity 'R'

in theory, within the metrics function of views.py, adding .filter() should allow filtering needed, something like:

views.py

def metrics(request):
    ctx = {
        'most_picked_cards': MostPickedCardPickRate.objects.all().filter(get_set_query(['MOA']) & Q(rarity='R')order_by('-percentage'),
        'attribute_picks': AttributePickRate.objects.all().order_by('-percentage'),
        'total_cost_picks': CardTotalCostPickRate.objects.all().order_by('-total_cost'),
        'card_type_picks': CardTypePickRate.objects.all().order_by('-percentage'),
        'pick_periods': PickPeriod.objects.all()
    }
    return render(request, 'cardDatabase/html/metrics.html', ctx)
Niebvelungen commented 4 months ago

What is the extend of the needed filter options? Attribute, Card Type, etc?