Skip to content

Commit 22af21c

Browse files
committed
minor bug fixes
- fixed a bug where the game directory cache pulled mismatched information - fixed a bug where the "Loading games..." text was not rendering
1 parent 83f9891 commit 22af21c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

database.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ document.directory.nextBoards = [];
108108

109109
function prepareDirectory(boards) {
110110
$("#games-container").empty();
111+
displayGame(['','','','Loading Games...','This may take a second.','','','','','','','','',''], null);
111112
if (boards.length > 60) {
112113
document.directory.upToDate = false;
113114
localDirectory.transpositions = [];
@@ -352,23 +353,24 @@ function gamesObserver(count) {
352353

353354
function pullGames(requests, database) {
354355
const criteria = [$("#Sort").val().slice(0, -3), $("#Sort").val().slice(-3)];
356+
const collection = $("#collection").val();
355357
document.directory.search.temp = [];
356358
$.each(requests, (i, r) => {
357359
let location;
358360
if (r[0] == 5000)
359361
location = `${prefix}${database}/chunks/${zfill(r[1])}.csv`;
360362
else
361363
location = `${prefix}${database}/sorted/${criteria[0]}/${criteria[1]}/${r[0]}/${zfill(r[1])}.csv`;
362-
games = document.directory.search.cache[r.toString()]
364+
games = document.directory.search.cache[r.toString() + criteria.toString() + ',' + collection];
363365
if (games) {
364366
document.directory.search.temp.push(games);
365-
console.log(`cache hit ${location}`)
367+
console.log(`cache hit ${r.toString() + criteria.toString() + ',' + collection}`)
366368
return;
367369
} else {
368370
$.when($.get(location)).done(games => {
369-
console.log(`cache miss ${location}`)
371+
console.log(`cache miss ${r.toString() + criteria.toString() + ',' + collection}`)
370372
const arr = $.csv.toArrays(games).slice(1, -1);
371-
document.directory.search.cache[r.toString()] = arr;
373+
document.directory.search.cache[r.toString() + criteria.toString() + ',' + collection] = arr;
372374
document.directory.search.temp.push(arr);
373375
});
374376
}

0 commit comments

Comments
 (0)