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

Usability fix for the rank command #34

Merged
merged 12 commits into from
Jan 16, 2019
Prev Previous commit
Next Next commit
Additonal Review updates
1) Cleaned up rank command examples

2) The spreadsheet formatting of the playername will now be used in the table output
  • Loading branch information
drgoonic committed Nov 28, 2018
commit 3c25aacfa2b54fd8788810864d73a28f041fb7a8
2 changes: 1 addition & 1 deletion commands/misc/speedrank.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = class ReplyCommand extends Command {
description: 'Looks up all the entries for a given speedrunner in a specified leaderboard' +
' from the FFRecordKeeper Discord Speedrun challenge leaderboard' +
' (https://docs.google.com/spreadsheets/d/11gTjAkpm4D3uoxnYCN7ZfbiVnKyi7tmm9Vp9HvTkGpw).',
examples: ['rank EverythingIsGravy 5star', 'top 10 no-csb', 'top 5 cod', 'top 3 Maliris'],
examples: ['rank EverythingIsGravy 5star', 'rank dragoonic 4star no-csb', 'rank littlefiredragon'],
args: [
{
key: 'name',
Expand Down
9 changes: 8 additions & 1 deletion utilities/speedrank-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ exports.speedrank = function lookupspeedrank(

let contestants = [];
let padLength = 0;
let playerActualName = player;

// Now that we know the fights, let's search each fight column for the player in question
for (let catName of fightNames) {
Expand All @@ -117,7 +118,13 @@ exports.speedrank = function lookupspeedrank(
console.log(padLength);
}
if (cell.toLowerCase() === player.toLowerCase()) {

//Grab the spreadsheet formatted version of the player's name
playerActualName = cell;

//Grab the name of the boss the player has an entry for
contestant.push(catName);

// Grab the actual rank of this row
contestant.push(checkCell(data.values[row][0]));

Expand All @@ -135,7 +142,7 @@ exports.speedrank = function lookupspeedrank(
}
}
const rankTable =
outputRankTable(categorySheet, player,
outputRankTable(categorySheet, playerActualName,
categoryNames, contestants, padLength);
msg.channel.send(rankTable)
.then( (res) => {
Expand Down