Skip to content

Instantly share code, notes, and snippets.

@gabriel403
Created November 11, 2017 14:17
Show Gist options
  • Save gabriel403/067233ea6bc53c5016c8729fbd07aed5 to your computer and use it in GitHub Desktop.
Save gabriel403/067233ea6bc53c5016c8729fbd07aed5 to your computer and use it in GitHub Desktop.
crap sorting function
$scope.sortByTags = function(model) {
let score = 10000;
if (model.tags.includes('pc')) {score -= 1000}
if (model.tags.includes('monk')) {score -= 900}
if (model.tags.includes('ranger')) {score -= 800}
if (model.tags.includes('rogue')) {score -= 700}
if (model.tags.includes('fighter')) {score -= 600}
if (model.tags.includes('barbarian')) {score -= 500}
if (model.tags.includes('wizard')) {score -= 400}
if (model.tags.includes('sorcerer')) {score -= 300}
if (model.tags.includes('human')) {score -= 90}
if (model.tags.includes('elf')) {score -= 80}
if (model.tags.includes('halfling')) {score -= 70}
if (model.tags.includes('dwarf')) {score -= 60}
if (model.tags.includes('female')) {score -= 9}
if (model.tags.includes('male')) {score -= 8}
return score;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment