This commit is contained in:
Yanick Champoux 2023-01-17 10:15:00 -05:00
parent 0cae4d22c9
commit 1007b7f9cb
3 changed files with 2 additions and 8 deletions

View File

@ -76,8 +76,6 @@
<script> <script>
import * as R from 'remeda'; import * as R from 'remeda';
import { getContext } from 'svelte'; import { getContext } from 'svelte';
// import { goto } from '$app/navigation';
const goto = () => {};
export let api = getContext('api'); export let api = getContext('api');
export let campaigns = api?.campaigns; export let campaigns = api?.campaigns;

View File

@ -33,7 +33,6 @@ function calculateScore(campaign) {
.map(({ difficulty }) => parseInt(difficulty)) .map(({ difficulty }) => parseInt(difficulty))
.map((x) => (Number.isNaN(x) ? 0 : x)), .map((x) => (Number.isNaN(x) ? 0 : x)),
]; ];
console.log(values);
return values.reduce((a, b) => a + b, 0); return values.reduce((a, b) => a + b, 0);
} }
@ -52,7 +51,6 @@ export function updateBattle(campaign, battleId, status) {
}); });
campaign = u.updateIn(campaign, 'score', calculateScore(campaign)); campaign = u.updateIn(campaign, 'score', calculateScore(campaign));
console.log(campaign);
campaign = u(campaign, { campaign = u(campaign, {
status: campaignStatus(campaign), status: campaignStatus(campaign),
@ -66,7 +64,6 @@ export function updateBattle(campaign, battleId, status) {
}), }),
], ],
}); });
console.log('updated', campaign);
} }
return campaign; return campaign;
} }
@ -127,11 +124,12 @@ export function genApi(options = {}) {
difficulty, difficulty,
}), }),
) )
.catch((e) => console.error(e)); .catch((e) => console.error(e)); // eslint-disable-line
}; };
const setBattleVerdict = (battleId, status) => { const setBattleVerdict = (battleId, status) => {
const campaign = updateBattle(get(activeCampaign), battleId, status); const campaign = updateBattle(get(activeCampaign), battleId, status);
// eslint-disable-next-line
pouchdb.put(campaign).catch((e) => console.error(e)); pouchdb.put(campaign).catch((e) => console.error(e));
}; };

View File

@ -103,8 +103,6 @@ export function genChapter3Battle(battles) {
} }
export function genChapter4Battle(battles) { export function genChapter4Battle(battles) {
const chapter = 4;
const scenario = 'The Last Battle'; const scenario = 'The Last Battle';
const cities = R.difference( const cities = R.difference(