christopher commited on
Commit
036ca5b
·
1 Parent(s): 0c4536a

Update static/app.js

Browse files
Files changed (1) hide show
  1. static/app.js +2 -1
static/app.js CHANGED
@@ -27,6 +27,7 @@ function search() {
27
  .then(r => r.json())
28
  .then(data => {
29
  allResults = data.results;
 
30
  currentPage = 0;
31
  displayPage();
32
  });
@@ -38,7 +39,7 @@ function displayPage() {
38
  const pageResults = allResults.slice(start, end);
39
  const totalPages = Math.ceil(allResults.length / RESULTS_PER_PAGE);
40
 
41
- let html = `<h2>Found ${allResults.length} puzzles (page ${currentPage + 1} of ${totalPages})</h2>`;
42
  html += `<div class="pagination">
43
  <button onclick="prevPage()" ${currentPage === 0 ? 'disabled' : ''}>Previous</button>
44
  <button onclick="nextPage()" ${end >= allResults.length ? 'disabled' : ''}>Next</button>
 
27
  .then(r => r.json())
28
  .then(data => {
29
  allResults = data.results;
30
+ window.searchTimeMs = data.time_ms;
31
  currentPage = 0;
32
  displayPage();
33
  });
 
39
  const pageResults = allResults.slice(start, end);
40
  const totalPages = Math.ceil(allResults.length / RESULTS_PER_PAGE);
41
 
42
+ let html = `<h2>Found ${allResults.length} puzzles in ${window.searchTimeMs.toFixed(0)}ms (page ${currentPage + 1} of ${totalPages})</h2>`;
43
  html += `<div class="pagination">
44
  <button onclick="prevPage()" ${currentPage === 0 ? 'disabled' : ''}>Previous</button>
45
  <button onclick="nextPage()" ${end >= allResults.length ? 'disabled' : ''}>Next</button>