mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
fix(scanner): play disc-folder audiobook tracks disc by disc
The walker sorted a book's files by file name, so tracks in disc folders that reuse names, such as CD 1/01.mp3 and CD 2/01.mp3, interleaved in playback, merged chapters, and written track numbers. Order them by their whole path instead, everywhere a track order is chosen. A rescan that only reorders a book's existing tracks now moves every audio bookmark and the listening progress percentage to the same moment of the same track, and rebuilds merged chapters. Disc folders are never skipped by incremental scans, so existing libraries are fixed by their next scan. Also inventory the notebook and dashboard highlights routes in the authorization matrix, and pin the app locale in two date tests that depended on the machine's locale.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import type { AchievementItem } from '@bookorbit/types'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { i18n } from '@/i18n'
|
||||
import TieredAchievementCard from '../components/TieredAchievementCard.vue'
|
||||
import type { TieredGroup } from '../types'
|
||||
|
||||
@@ -189,9 +190,11 @@ describe('TieredAchievementCard', () => {
|
||||
})
|
||||
|
||||
it('expanded panel shows tier dates for earned tiers', async () => {
|
||||
// Dates follow the app locale, not the machine's, so pin both sides to it.
|
||||
i18n.global.locale.value = 'en'
|
||||
const wrapper = mount(TieredAchievementCard, { props: { group: makeGroup() } })
|
||||
await wrapper.trigger('click')
|
||||
const expectedDate = new Date('2026-05-15T00:00:00Z').toLocaleDateString(undefined, {
|
||||
const expectedDate = new Date('2026-05-15T00:00:00Z').toLocaleDateString('en', {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { i18n } from '@/i18n'
|
||||
import {
|
||||
cfiRangesMatch,
|
||||
cfiRangesOverlap,
|
||||
@@ -18,8 +19,10 @@ describe('epub utils', () => {
|
||||
})
|
||||
|
||||
it('formats dates using locale short month/day/year format', () => {
|
||||
// Dates follow the app locale, not the machine's, so pin both sides to it.
|
||||
i18n.global.locale.value = 'en'
|
||||
const iso = '2026-02-14T12:00:00.000Z'
|
||||
const expected = new Date(iso).toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' })
|
||||
const expected = new Date(iso).toLocaleDateString('en', { month: 'short', day: 'numeric', year: 'numeric' })
|
||||
|
||||
expect(formatDate(iso)).toBe(expected)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user