Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Usability fix for the rank command (#34)
Browse files Browse the repository at this point in the history
* SpeedRank added

Added the "rank" command to allow speedrunners to pull their specific stats in the general categories.

The new command has the form:
rank <playername> <category> <type>
playername = name in the speedrun sheet
category = 3star, 4star, 5star, or Torment (defaults to 4star)
type = overall or no-csb (defaults to overall)

* Modifcations based on review

Removed some extraneous changes from commit

Brought rank command in line with template literal usage

* Update package-lock.json

* Additonal Review updates

1) Cleaned up rank command examples

2) The spreadsheet formatting of the playername will now be used in the table output

* Usability fix for rank parsing

The "rank" command now accepts a wider range of inputs for both category and subcategory.

-ignores case
-magicites accept '3','3star','3-star','3 star'
-torment accepts 'torment', 'tor', 'neotorment', 'neo'
-no csb recognizes 'no-csb','nocsb','no','no csb'
  • Loading branch information
drgoonic authored and brasstax committed Jan 16, 2019
1 parent 64e3042 commit 368fe0a
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions utilities/speedrank-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,26 +162,29 @@ exports.speedrank = function lookupspeedrank(
**/
function getSheet(category, secondaryCategory) {
let version = "Overall";
if (secondaryCategory === 'no-csb'){

// check for various permutations of "No CSB"
if (['no-csb','nocsb','no','no csb'].includes(secondaryCategory.toLowerCase())){
version = 'No CSB';
}
switch (category) {
case '3star':
category = `GL 3* ${version} rankings`;
break;
case '4star':
category = `GL 4* ${version} rankings`;
break;
case '5star':
//category = 'GL 5* '+version+ ' rankings';
category = `GL 5* ${version} rankings`;
break;
case 'torment':
category = 'Torment';
break;
default:
category = 'Error';
}

// check for various permutations of fight, e.g. "4 star", "Torment" and convert to sheet name
if (['3','3star','3-star','3 star'].includes(category.toLowerCase())){
category = `GL 3* ${version} rankings`;
}
else if (['4','4star','4-star','4 star'].includes(category.toLowerCase())){
category = `GL 4* ${version} rankings`;
}
else if (['5','5star','5-star','5 star'].includes(category.toLowerCase())){
category = `GL 5* ${version} rankings`;
}
else if (['torment', 'tor', 'neotorment', 'neo'].includes(category.toLowerCase())){
category = 'Torment';
}
else{
category = 'Error';
}

return category;
}
/**
Expand Down

0 comments on commit 368fe0a

Please sign in to comment.