mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-20 12:11:28 -07:00
fix: normalize stats lookup copy from tokens to words
This commit is contained in:
@@ -18,8 +18,8 @@ const summary: OverviewSummary = {
|
|||||||
activeDays: 12,
|
activeDays: 12,
|
||||||
totalSessions: 15,
|
totalSessions: 15,
|
||||||
lookupRate: {
|
lookupRate: {
|
||||||
shortValue: '2.3 / 100 tokens',
|
shortValue: '2.3 / 100 words',
|
||||||
longValue: '2.3 lookups per 100 tokens',
|
longValue: '2.3 lookups per 100 words',
|
||||||
},
|
},
|
||||||
todayTokens: 0,
|
todayTokens: 0,
|
||||||
newWordsToday: 0,
|
newWordsToday: 0,
|
||||||
@@ -33,8 +33,8 @@ test('TrackingSnapshot renders Yomitan lookup rate copy on the homepage card', (
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.match(markup, /Lookup Rate/);
|
assert.match(markup, /Lookup Rate/);
|
||||||
assert.match(markup, /2\.3 \/ 100 tokens/);
|
assert.match(markup, /2\.3 \/ 100 words/);
|
||||||
assert.match(markup, /Lifetime Yomitan lookups normalized by total tokens seen/);
|
assert.match(markup, /Lifetime Yomitan lookups normalized by total words seen/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('TrackingSnapshot labels new words as unique headwords', () => {
|
test('TrackingSnapshot labels new words as unique headwords', () => {
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ export function TrendsTab() {
|
|||||||
color={cardsMinedColor}
|
color={cardsMinedColor}
|
||||||
type="bar"
|
type="bar"
|
||||||
/>
|
/>
|
||||||
<TrendChart title="Tokens Seen" data={data.activity.words} color="#8bd5ca" type="bar" />
|
<TrendChart title="Words Seen" data={data.activity.words} color="#8bd5ca" type="bar" />
|
||||||
<TrendChart title="Sessions" data={data.activity.sessions} color="#b7bdf8" type="bar" />
|
<TrendChart title="Sessions" data={data.activity.sessions} color="#b7bdf8" type="bar" />
|
||||||
|
|
||||||
<SectionHeader>Period Trends</SectionHeader>
|
<SectionHeader>Period Trends</SectionHeader>
|
||||||
@@ -194,7 +194,7 @@ export function TrendsTab() {
|
|||||||
type="line"
|
type="line"
|
||||||
/>
|
/>
|
||||||
<TrendChart title="Sessions" data={data.progress.sessions} color="#b7bdf8" type="line" />
|
<TrendChart title="Sessions" data={data.progress.sessions} color="#b7bdf8" type="line" />
|
||||||
<TrendChart title="Tokens Seen" data={data.progress.words} color="#8bd5ca" type="line" />
|
<TrendChart title="Words Seen" data={data.progress.words} color="#8bd5ca" type="line" />
|
||||||
<TrendChart
|
<TrendChart
|
||||||
title="New Words Seen"
|
title="New Words Seen"
|
||||||
data={data.progress.newWords}
|
data={data.progress.newWords}
|
||||||
@@ -215,7 +215,7 @@ export function TrendsTab() {
|
|||||||
/>
|
/>
|
||||||
<TrendChart title="Lookups" data={data.progress.lookups} color="#f5bde6" type="line" />
|
<TrendChart title="Lookups" data={data.progress.lookups} color="#f5bde6" type="line" />
|
||||||
<TrendChart
|
<TrendChart
|
||||||
title="Lookups / 100 Tokens"
|
title="Lookups / 100 Words"
|
||||||
data={data.ratios.lookupsPerHundred}
|
data={data.ratios.lookupsPerHundred}
|
||||||
color="#f5a97f"
|
color="#f5a97f"
|
||||||
type="line"
|
type="line"
|
||||||
@@ -246,7 +246,7 @@ export function TrendsTab() {
|
|||||||
data={filteredCardsPerAnime}
|
data={filteredCardsPerAnime}
|
||||||
colorPalette={cardsMinedStackedColors}
|
colorPalette={cardsMinedStackedColors}
|
||||||
/>
|
/>
|
||||||
<StackedTrendChart title="Tokens Seen per Anime" data={filteredWordsPerAnime} />
|
<StackedTrendChart title="Words Seen per Anime" data={filteredWordsPerAnime} />
|
||||||
<StackedTrendChart title="Lookups per Anime" data={filteredLookupsPerAnime} />
|
<StackedTrendChart title="Lookups per Anime" data={filteredLookupsPerAnime} />
|
||||||
<StackedTrendChart
|
<StackedTrendChart
|
||||||
title="Lookups/100w per Anime"
|
title="Lookups/100w per Anime"
|
||||||
@@ -261,7 +261,7 @@ export function TrendsTab() {
|
|||||||
data={filteredCardsProgress}
|
data={filteredCardsProgress}
|
||||||
colorPalette={cardsMinedStackedColors}
|
colorPalette={cardsMinedStackedColors}
|
||||||
/>
|
/>
|
||||||
<StackedTrendChart title="Tokens Seen Progress" data={filteredWordsProgress} />
|
<StackedTrendChart title="Words Seen Progress" data={filteredWordsProgress} />
|
||||||
|
|
||||||
<SectionHeader>Patterns</SectionHeader>
|
<SectionHeader>Patterns</SectionHeader>
|
||||||
<TrendChart
|
<TrendChart
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ test('buildOverviewSummary aggregates tracked totals and recent windows', () =>
|
|||||||
assert.equal(summary.activeDays, 2);
|
assert.equal(summary.activeDays, 2);
|
||||||
assert.equal(summary.totalSessions, 15);
|
assert.equal(summary.totalSessions, 15);
|
||||||
assert.deepEqual(summary.lookupRate, {
|
assert.deepEqual(summary.lookupRate, {
|
||||||
shortValue: '2.3 / 100 tokens',
|
shortValue: '2.3 / 100 words',
|
||||||
longValue: '2.3 lookups per 100 tokens',
|
longValue: '2.3 lookups per 100 words',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ test('MediaSessionList renders expandable session rows with delete affordance',
|
|||||||
assert.match(markup, /Session History/);
|
assert.match(markup, /Session History/);
|
||||||
assert.match(markup, /aria-expanded="true"/);
|
assert.match(markup, /aria-expanded="true"/);
|
||||||
assert.match(markup, /Delete session Episode 7/);
|
assert.match(markup, /Delete session Episode 7/);
|
||||||
assert.match(markup, /tokens/);
|
assert.match(markup, /words/);
|
||||||
assert.match(markup, /No token data for this session/);
|
assert.match(markup, /No word data for this session/);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ test('SessionDetail omits the misleading new words metric', () => {
|
|||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.match(markup, /No token data/);
|
assert.match(markup, /No word data/);
|
||||||
assert.doesNotMatch(markup, /New words/);
|
assert.doesNotMatch(markup, /New words/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import { SessionRow } from '../components/sessions/SessionRow';
|
|||||||
import { EventType, type SessionEvent } from '../types/stats';
|
import { EventType, type SessionEvent } from '../types/stats';
|
||||||
import { buildLookupRateDisplay, getYomitanLookupEvents } from './yomitan-lookup';
|
import { buildLookupRateDisplay, getYomitanLookupEvents } from './yomitan-lookup';
|
||||||
|
|
||||||
test('buildLookupRateDisplay formats lookups per 100 tokens in short and long forms', () => {
|
test('buildLookupRateDisplay formats lookups per 100 words in short and long forms', () => {
|
||||||
assert.deepEqual(buildLookupRateDisplay(23, 1000), {
|
assert.deepEqual(buildLookupRateDisplay(23, 1000), {
|
||||||
shortValue: '2.3 / 100 tokens',
|
shortValue: '2.3 / 100 words',
|
||||||
longValue: '2.3 lookups per 100 tokens',
|
longValue: '2.3 lookups per 100 words',
|
||||||
});
|
});
|
||||||
assert.equal(buildLookupRateDisplay(0, 0), null);
|
assert.equal(buildLookupRateDisplay(0, 0), null);
|
||||||
});
|
});
|
||||||
@@ -49,11 +49,11 @@ test('MediaHeader renders Yomitan lookup count and lookup rate copy', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.match(markup, /23/);
|
assert.match(markup, /23/);
|
||||||
assert.match(markup, /2\.3 \/ 100 tokens/);
|
assert.match(markup, /2\.3 \/ 100 words/);
|
||||||
assert.match(markup, /2\.3 lookups per 100 tokens/);
|
assert.match(markup, /2\.3 lookups per 100 words/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('MediaHeader distinguishes token occurrences from known unique words', () => {
|
test('MediaHeader distinguishes word occurrences from known unique words', () => {
|
||||||
const markup = renderToStaticMarkup(
|
const markup = renderToStaticMarkup(
|
||||||
<MediaHeader
|
<MediaHeader
|
||||||
detail={{
|
detail={{
|
||||||
@@ -76,7 +76,7 @@ test('MediaHeader distinguishes token occurrences from known unique words', () =
|
|||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.match(markup, /token occurrences/);
|
assert.match(markup, /word occurrences/);
|
||||||
assert.match(markup, /known unique words \(50%\)/);
|
assert.match(markup, /known unique words \(50%\)/);
|
||||||
assert.match(markup, /17 \/ 34/);
|
assert.match(markup, /17 \/ 34/);
|
||||||
});
|
});
|
||||||
@@ -105,7 +105,7 @@ test('EpisodeList renders per-episode Yomitan lookup rate', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.match(markup, /Lookup Rate/);
|
assert.match(markup, /Lookup Rate/);
|
||||||
assert.match(markup, /2\.0 \/ 100 tokens/);
|
assert.match(markup, /2\.0 \/ 100 words/);
|
||||||
assert.match(markup, /6%/);
|
assert.match(markup, /6%/);
|
||||||
assert.doesNotMatch(markup, /90%/);
|
assert.doesNotMatch(markup, /90%/);
|
||||||
});
|
});
|
||||||
@@ -139,11 +139,11 @@ test('AnimeOverviewStats renders aggregate Yomitan lookup metrics', () => {
|
|||||||
|
|
||||||
assert.match(markup, /Lookups/);
|
assert.match(markup, /Lookups/);
|
||||||
assert.match(markup, /16/);
|
assert.match(markup, /16/);
|
||||||
assert.match(markup, /2\.0 \/ 100 tokens/);
|
assert.match(markup, /2\.0 \/ 100 words/);
|
||||||
assert.match(markup, /Yomitan lookups per 100 tokens seen/);
|
assert.match(markup, /Yomitan lookups per 100 words seen/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('SessionRow prefers token-based word count when available', () => {
|
test('SessionRow prefers word-based count when available', () => {
|
||||||
const markup = renderToStaticMarkup(
|
const markup = renderToStaticMarkup(
|
||||||
<SessionRow
|
<SessionRow
|
||||||
session={{
|
session={{
|
||||||
|
|||||||
Reference in New Issue
Block a user