Changeset 34987


Ignore:
Timestamp:
2021-04-03T09:41:18+13:00 (3 years ago)
Author:
davidb
Message:

Adding in reverse ordering to allow group select in SPARQL to pick out things like the bottom entry/entries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/voting-excel/xlsx-tocountry-jsonmetadata.py

    r34960 r34987  
    478478            to_year_votes[i][0]["FinishingPos"] = finishing_pos
    479479
    480            
     480        # Put into reverse order and then number:
     481        #   useful for selecting 'bottom <n>' entrants without needing to know
     482        #   totoal number of entrants that year
     483        to_year_votes.sort(key=lambda v: v[0].get("VoteGrandTotal"), reverse=False)
     484        for i in range(to_year_num_votes):
     485            rev_finishing_pos = i+1
     486            to_year_votes[i][0]["ReverseFinishingPos"] = rev_finishing_pos
     487
     488        # Put things back to how they were, just to be tidy
     489        to_year_votes.sort(key=lambda v: v[0].get("VoteGrandTotal"), reverse=True)
     490       
    481491def gs_yc_directory_metadata(to_year_then_country_voting_groups):
    482492    # Next step is to express the grouped to-country voting data
Note: See TracChangeset for help on using the changeset viewer.