stevschmid/trackobot.com — pull request #9 by ganwell (2014-11-12 14:11:12+00:00)
Title: Changing deck match-quality from count to quotient

This is not meant to merge just yet. I think the formula is pretty decent, but I am not sure about the SQL.

Commit Message
-----------------------

When you define deck A with 4 cards and deck B with 10 cards
and result C will match A=4, B=5 cards then A is a better
match. Its a 100% match to A versus a 50% match to B.

Respecting this allows you to define some general
deck-categories and more specific decks. If the deck matches
a specific deck well, the specific will be selected,
otherwise it will fall back to a general deck.

Of course if less cards are played than defined in the
deck, the played cards count is used as divider. When the
quotient is the same, the deck with more cards (more
specific) wins:

cards_matching * 10000 / min(cards_deck, cards_played) + cards_deck