display tweaks

This commit is contained in:
Anthony Mineo 2020-04-14 20:43:43 -04:00
parent 8fc23cc6e4
commit 093636fc6d
3 changed files with 47 additions and 7 deletions

View file

@ -9,15 +9,25 @@ class GameController {
const pageTitle = `Latest Games`; const pageTitle = `Latest Games`;
const gamesQry = await Database.raw(` // const gamesQry = await Database.raw(`
SELECT distinct game_id,map,gametype, datestamp // SELECT distinct game_id,map,gametype, datestamp
FROM games // FROM games
WHERE (stats->>'score' IS NOT NULL) AND (game_id <> 0) // WHERE (stats->>'score' IS NOT NULL) AND (game_id <> 0)
ORDER BY game_id desc // ORDER BY game_id desc
LIMIT 2000; // LIMIT 2000;
`); // `);
const gamesQry = await Database.raw(`
WITH gamelist AS (
SELECT DISTINCT p.game_id, p.map, p.gametype, p.datestamp, count(*) OVER (PARTITION BY game_id) as count from games p
)
SELECT * from gamelist
WHERE (count > 1) AND (game_id <> 0)
ORDER BY game_id desc
LIMIT 2000
`);
// filter out duplicate game_ids (https://dev.to/marinamosti/removing-duplicates-in-an-array-of-objects-in-js-with-sets-3fep) // filter out duplicate game_ids (https://dev.to/marinamosti/removing-duplicates-in-an-array-of-objects-in-js-with-sets-3fep)
const games = gamesQry.rows.reduce((game, current) => { const games = gamesQry.rows.reduce((game, current) => {

View file

@ -40,6 +40,7 @@ class PlayerController {
'gametype', 'gametype',
'stats') 'stats')
.where({ player_guid: request.params.player_guid }) .where({ player_guid: request.params.player_guid })
.orderBy('game_id', 'desc')
.limit(50) .limit(50)

View file

@ -14,12 +14,41 @@
@endif @endif
</head> </head>
<body class="antialiased font-sans bg-gray-200"> <body class="antialiased font-sans bg-gray-200">
<div id="popup" class="relative bg-indigo-600">
<div class="max-w-screen-xl mx-auto py-3 px-3 sm:px-6 lg:px-8">
<div class="pr-16 sm:text-center sm:px-16">
<p class="font-medium text-white">
Hey! This is a preview. Things aren't quite finished yet. Stay tuned!
</p>
</div>
<div class="absolute inset-y-0 right-0 pt-1 pr-1 flex items-start sm:pt-1 sm:pr-2 sm:items-start">
<button type="button" class="flex p-2 rounded-md hover:bg-indigo-500 focus:outline-none focus:bg-indigo-500 transition ease-in-out duration-150" onclick="closePopUp()">
<svg class="h-6 w-6 text-white" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
</div>
</div>
{{{ startTag }}} {{{ startTag }}}
{{-- {{ edgeVar }} --}} {{-- {{ edgeVar }} --}}
@if(node_env().env === "production" || node_env().hmr === "false") @if(node_env().env === "production" || node_env().hmr === "false")
{{ script(versionjs('app')) }} {{ script(versionjs('app')) }}
@else @else
{{ script('http://localhost:8081/dist/js/app.js') }} {{ script('http://localhost:8081/dist/js/app.js') }}
@endif @endif
<script>
function closePopUp(){
document.getElementById("popup").remove();
};
</script>
</body> </body>
</html> </html>