Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fitztrev committed Feb 11, 2024
1 parent 8f67924 commit facb0f7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
15 changes: 13 additions & 2 deletions sample-data/generate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ function newGame(): Chess {

const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));

const result = (game: Chess) => {
if (game.isCheckmate() && game.turn() === 'w') {
return '0-1';
} else if (game.isCheckmate() && game.turn() === 'b') {
return '1-0';
} else if (game.isDraw()) {
return '1/2-1/2';
}

throw new Error('Game is not over');
};

if (action === 'games') {
const games = new Map<number, Chess>();

Expand All @@ -74,8 +86,7 @@ if (action === 'games') {
await sleep(faker.number.int({ min: 500, max: 2_000 }));
}

const result = game.isDraw() ? '1/2-1/2' : game.turn() === 'w' ? '0-1' : '1-0';
game.header('Result', result);
game.header('Result', result(game));
writeToFile(i, game.pgn());
}),
);
Expand Down
2 changes: 1 addition & 1 deletion sample-data/tournaments/tournament-1/assets/style.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/* */
/* empty */
2 changes: 0 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ listen<number>('event::queue_size', event => {
});
listen<PgnPushResult>('event::upload_success', event => {
// logs.moveCount += event.payload.response.moves;
event.payload.files.forEach(file => {
logs.files.add(file);
});
Expand Down
8 changes: 0 additions & 8 deletions src/components/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ const status = computed<Status>(() => {
<span class="text-4xl font-semibold tracking-tight text-white">{{ logs.files.size }}</span>
</p>
</div>
<!-- <div class="bg-gray-700 px-4 py-6 sm:px-6 lg:px-8">
<p class="text-sm font-medium leading-6 text-gray-400">Moves</p>
<p class="mt-2 flex items-baseline gap-x-2">
<span class="text-4xl font-semibold tracking-tight text-white">{{
logs.moveCount
}}</span>
</p>
</div> -->
</div>
</div>
<LogViewer />
Expand Down
4 changes: 2 additions & 2 deletions src/components/FolderWatcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function startWatchingFolder(path: string) {
});
}
async function handleFolderChange(events: DebouncedEvent) {
function handleFolderChange(events: DebouncedEvent): void {
const files = events
.filter(event => event.kind === 'Any')
.filter(event => isSingleGamePgn(event.path))
Expand All @@ -46,7 +46,7 @@ async function handleFolderChange(events: DebouncedEvent) {
return;
}
await add_to_queue(props.roundId, files);
add_to_queue(props.roundId, files);
const paths = files.map(file => file.split('/').pop());
logs.info(`Modified: ${paths.join(', ')}`);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Round.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function getRound() {
}
async function uploadExistingFilesInFolder() {
let files = await recursiveFileList(watchedFolder.value!);
let files = await recursiveFileList(watchedFolder.value);
files = files.filter(file => isSingleGamePgn(file));
await add_to_queue(round.value!.round.id, files);
Expand Down
1 change: 0 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import vue from '@vitejs/plugin-vue';
// import { defineConfig } from "vite";
import { defineConfig } from 'vitest/config';

// https://vitejs.dev/config/
Expand Down

0 comments on commit facb0f7

Please sign in to comment.