Skip to content

Commit

Permalink
Merge pull request #187 from yssk22/develop
Browse files Browse the repository at this point in the history
[expo] remove topological sort
  • Loading branch information
yssk22 authored Dec 22, 2024
2 parents fbc441d + 0c114e9 commit 6929efe
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 495 deletions.
14 changes: 5 additions & 9 deletions expo/features/hpsort/HPSortNewScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
import { WithSafeArea } from '@hpapp/features/common';
import { defineScreen, useScreenTitle } from '@hpapp/features/common/stack';
import { t } from '@hpapp/system/i18n';
import { useState } from 'react';

import HPSortNewConfigForm from './internals/new/HPSortNewConfigForm';
import HPSortNewRoundContainer from './internals/new/HPSortNewRoundContainer';
import { HPSortNewConfig } from './internals/new/types';

export type HPSortNewSceenProps = object;

export default defineScreen('/hpsort/new/', function HPSortNewSceen() {
useScreenTitle(t('New Sort'));
const [config, setConfig] = useState<HPSortNewConfig | null>(null);

return (
<WithSafeArea>
{config === null ? (
<HPSortNewConfigForm onSelect={(config) => setConfig(config)} />
) : (
<HPSortNewRoundContainer config={config} />
)}
<HPSortNewRoundContainer
config={{
numMembersToSelect: 2
}}
/>
</WithSafeArea>
);
});
78 changes: 0 additions & 78 deletions expo/features/hpsort/internals/new/HPSortNewConfigForm.tsx

This file was deleted.

13 changes: 2 additions & 11 deletions expo/features/hpsort/internals/new/HPSortNewRoundContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import HPSortNewRoundMemberSelector from './HPSortNewRoundMemberSelector';
import { HPSortMemberNode, HPSortNewConfig, HPSortNewRoundState } from './types';
import HPSortBase from '../sort/HPSortBase';
import HPSortClassicMergeSort from '../sort/HPSortClassicMergeSort';
import HPSortTopologicalSort from '../sort/HPSortTopologicalSort';

export type HPSortNewRoundContainerProps = {
config: HPSortNewConfig;
Expand All @@ -30,11 +29,7 @@ export default function HPSortNewRoundContainer({ config }: HPSortNewRoundContai
});
return object.shuffle([...members]).map((m) => new HPSortMemberNode(m));
}, [members]);
const [sorter, setSorter] = useState<HPSortBase<HPSortMemberNode>>(
config.numMembersToSelect === 2
? new HPSortClassicMergeSort(list)
: new HPSortTopologicalSort(list, config.numMembersToSelect, true)
);
const [sorter, setSorter] = useState<HPSortBase<HPSortMemberNode>>(new HPSortClassicMergeSort(list));
const comparable = sorter.getComparable();
const [stats, setStats] = useState<HPSortNewRoundState>({
numCompared: 0,
Expand All @@ -50,11 +45,7 @@ export default function HPSortNewRoundContainer({ config }: HPSortNewRoundContai
logEvent('hpsort_retry', {
num_members_to_select: config.numMembersToSelect
});
setSorter(
config.numMembersToSelect === 2
? new HPSortClassicMergeSort(list)
: new HPSortTopologicalSort(list, config.numMembersToSelect)
);
setSorter(new HPSortClassicMergeSort(list));
setStats({
numCompared: 0,
startTime: new Date(),
Expand Down
124 changes: 0 additions & 124 deletions expo/features/hpsort/internals/sort/HPSortTopologicalSort.test.ts

This file was deleted.

Loading

0 comments on commit 6929efe

Please sign in to comment.