update lichess explorer db to v3

explorer-config-quicktabs
Niklas Fiekas 2021-10-31 11:10:22 +01:00
parent 4c610c0e1d
commit 143391dfbe
2 changed files with 21 additions and 25 deletions

View File

@ -159,20 +159,23 @@ const playerDb = (ctrl: ExplorerConfigCtrl) => {
ctrl.data.color()
),
]),
speedSection(ctrl, allSpeeds),
h('div.advanced', [
h(
'button.button-link.toggle',
{
hook: bind('click', () => ctrl.data.advanced(!ctrl.data.advanced()), ctrl.root.redraw),
},
['Advanced settings ', iconTag(ctrl.data.advanced() ? '' : '')]
),
...(ctrl.data.advanced() ? [modeSection(ctrl), monthSection(ctrl)] : []),
]),
speedSection(ctrl),
advancedSection(ctrl, [modeSection(ctrl), monthSection(ctrl)]),
]);
};
const advancedSection = (ctrl: ExplorerConfigCtrl, content: VNode[]): VNode =>
h('div.advanced', [
h(
'button.button-link.toggle',
{
hook: bind('click', () => ctrl.data.advanced(!ctrl.data.advanced()), ctrl.root.redraw),
},
['Advanced settings ', iconTag(ctrl.data.advanced() ? '' : '')]
),
...(ctrl.data.advanced() ? content : []),
]);
const masterDb = (ctrl: ExplorerConfigCtrl) =>
h('div.masters.message', [
h('i', { attrs: dataIcon('') }),
@ -193,21 +196,19 @@ const radioButton =
const lichessDb = (ctrl: ExplorerConfigCtrl) =>
h('div', [
h('p.message', [h('br'), 'Games from all Lichess players']),
speedSection(
ctrl,
allSpeeds.filter(s => s != 'ultraBullet' && s != 'correspondence')
),
h('p.message', [h('br'), 'Rated games sampled from all Lichess players']),
speedSection(ctrl),
h('section.rating', [
h('label', ctrl.root.trans.noarg('averageElo')),
h('div.choices', allRatings.map(radioButton(ctrl, ctrl.data.rating))),
]),
advancedSection(ctrl, [monthSection(ctrl)]),
]);
const speedSection = (ctrl: ExplorerConfigCtrl, speeds: Speed[]) =>
const speedSection = (ctrl: ExplorerConfigCtrl) =>
h('section.speed', [
h('label', ctrl.root.trans.noarg('timeControl')),
h('div.choices', speeds.map(radioButton(ctrl, ctrl.data.speed, s => iconTag(perf.icons[s])))),
h('div.choices', allSpeeds.map(radioButton(ctrl, ctrl.data.speed, s => iconTag(perf.icons[s])))),
]);
const modeSection = (ctrl: ExplorerConfigCtrl) =>

View File

@ -27,14 +27,11 @@ export async function opening(
params.set('play', opts.play.join(','));
if (opts.db !== 'masters') {
params.set('speeds', conf.speed().join(','));
conf
.speed()
.filter(s => s != 'ultraBullet' && s != 'correspondence')
.forEach(s => params.append('speeds[]', s)); // bc
if (conf.since()) params.set('since', conf.since());
if (conf.until()) params.set('until', conf.until());
}
if (opts.db === 'lichess') {
params.set('ratings', conf.rating().join(','));
for (const rating of conf.rating()) params.append('ratings[]', rating.toString()); // bc
}
if (opts.db === 'player') {
const playerName = conf.playerName.value();
@ -42,8 +39,6 @@ export async function opening(
params.set('player', playerName);
params.set('color', conf.color());
params.set('modes', conf.mode().join(','));
if (conf.since()) params.set('since', conf.since());
if (conf.until()) params.set('until', conf.until());
}
if (!opts.withGames) {
params.set('topGames', '0');