集計機能追加 (#434) #441

マージ済み
みてるぞ が 49 個のコミットを feature/434 から main へマージ 2026-11-01 19:39:06 +09:00
4個のファイルの変更、25行の追加、8行の削除
コミット f874d6e405 の変更だけを表示しています - すべてのコミットを表示
+1
ファイルの表示
@@ -28,6 +28,7 @@ class CountsPivotLayout
result = [] result = []
values.each_with_index do |tuple, index| values.each_with_index do |tuple, index|
result << { values: tuple, kind: 'data' } result << { values: tuple, kind: 'data' }
# A group continuing on the next page closes only on its final page.
following = values[index + 1] || next_values following = values[index + 1] || next_values
depths.reverse_each do |depth| depths.reverse_each do |depth|
prefix = tuple.first(depth) prefix = tuple.first(depth)
+18 -7
ファイルの表示
@@ -45,17 +45,28 @@ RSpec.describe 'Counts masked pivot contracts' do
end end
it 'preserves monthly name subtotals and grand totals across pages' do it 'preserves monthly name subtotals and grand totals across pages' do
settings = { 'resource' => 'tags', 'rows' => 'created_at:month name_ja' } settings = { 'resource' => 'tags', 'rows' => 'created_at:month name' }
complete = result(admin, settings) complete = result(admin, settings)
paged = result(admin, settings.merge('limit' => '1'))
expect(complete[:group_count]).to eq(3) expect(complete[:group_count]).to eq(3)
expect(grand(complete)).to eq(3) expect(grand(complete)).to eq(3)
expect(grand(paged)).to eq(3) (1..3).each do |page|
subtotal = paged[:pivot_totals].find do |cell| paged = result(admin, settings.merge('limit' => '1', 'page' => page.to_s))
cell[:row] == ['2023-01'] && cell[:column].empty? expect(grand(paged)).to eq(3)
subtotal = paged[:pivot_totals].find do |cell|
cell[:row] == ['2023-01'] && cell[:column].empty?
end
headers = paged[:row_headers].select { _1[:kind] == 'subtotal' }
if page == 3
expect(headers.map { _1[:values] }).to eq([['2023-01']])
expect(subtotal).not_to be_nil
expect(subtotal[:count]).to eq(3)
else
expect(headers).to eq([])
expect(subtotal).to be_nil
end
expect(paged[:cells].sum { _1[:count] }).to eq(1)
expect(paged[:group_count]).to eq(3)
end end
expect(subtotal[:count]).to eq(3)
expect(paged[:cells].sum { _1[:count] }).to eq(1)
end end
it 'preserves five tag occurrences after merging private tags and across pages' do it 'preserves five tag occurrences after merging private tags and across pages' do
+5 -1
ファイルの表示
@@ -348,7 +348,11 @@ test ('counts SSR renders the shell without result requests or embedded results'
assert.match (result.html, /<form[\s>]/) assert.match (result.html, /<form[\s>]/)
assert.doesNotMatch (result.html, /counts:|columns\.changedAt|fields\.actor/) assert.doesNotMatch (result.html, /counts:|columns\.changedAt|fields\.actor/)
assert.match (result.head, /<meta[^>]*name="robots"[^>]*content="noindex"/) assert.match (result.head, /<meta[^>]*name="robots"[^>]*content="noindex"/)
assert.match (result.head, /<title[^>]*>[^<]*集計[^<]*\|[^<]*<\/title>/) const titles = {
ja: { posts: '広場集計', tags: 'タグ集計' },
'ain-Kana': { posts: 'ミンタㇻ ウコピㇱキ', tags: 'シロシ ウコピㇱキ' } }
assert.match (result.head, new RegExp (
`<title[^>]*>${titles[locale][resource]} \\|[^<]*<\/title>`))
assert.match (result.head, /rel="canonical"/) assert.match (result.head, /rel="canonical"/)
assert.doesNotMatch (result.html, /private-discard|hidden-title|__counts_private__/) assert.doesNotMatch (result.html, /private-discard|hidden-title|__counts_private__/)
+1
ファイルの表示
@@ -7,6 +7,7 @@ export default mergeConfig (
viteConfig, viteConfig,
defineConfig ({ defineConfig ({
test: { environment: 'jsdom', test: { environment: 'jsdom',
testTimeout: 30_000,
exclude: ['**/node_modules/**', '**/dist/**', 'server.ssr.test.mjs'], exclude: ['**/node_modules/**', '**/dist/**', 'server.ssr.test.mjs'],
setupFiles: './src/test/setup.ts', setupFiles: './src/test/setup.ts',
globals: false } })) globals: false } }))