ignore missing clan restriction; fallback to user name
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 13 May 2019 21:20:29 +0000 (23:20 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 13 May 2019 21:20:29 +0000 (23:20 +0200)
getsc2clan
widget.html

index 328553523d7b6834281c05b2a5a26afa0c3fa49b..9e6222ac74e5690457212ad0190095c567d79e7c 100755 (executable)
@@ -16,7 +16,7 @@ if (@ARGV and all { m[/] } @ARGV) {
 my ($profiles, $clanmatches) = part { /\D/ } @ARGV;  # separate numbers
 $profiles && @{$profiles}
        or die "Usage: $0 <profile id>... [<clan name>...]\n";
-my ($clanmatch) = map { $_ && qr/\A(?:$_)\z/i } join '|', @{$clanmatches};
+my ($clanmatch) = map { $_ && qr/\A(?:$_)\z/i } join '|', @{$clanmatches || []};
 
 sub blizget {
        state $bliz = do {
index 64f35a252f067397445d576128b16e10c74b478a..d6f5f8d66ddeef85b5e32b721724e4873d38e5b2 100644 (file)
@@ -25,7 +25,7 @@
        .then(clan => {
                let tiernum = (rank) => rank <= 8 ? 1 : rank <= 25 ? 2 : rank <= 50 ? 3 : 4;
                document.getElementById('clan').outerHTML = `
-                       <h1>${clan.tag}</h1>
+                       <h1>${clan.tag || clan.members[0].name}</h1>
                        <ul class=ladders>
                        ${clan.ladders.map(ladder => `
                                <li class="rank ${ladder.league} tier${tiernum(ladder.rank)}"