1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
import {sortContributionsChronologically, sortFlashesChronologically}
from '#sort';
import {chunkByConditions, stitchArrays} from '#sugar';
export default {
contentDependencies: [
'generateArtistInfoPageChunkedList',
'generateArtistInfoPageFlashesChunk',
],
extraDependencies: ['wikiData'],
sprawl: ({wikiInfo}) => ({
enableFlashesAndGames:
wikiInfo.enableFlashesAndGames,
}),
query(sprawl, artist) {
const query = {};
const allContributions =
(sprawl.enableFlashesAndGames
? [
...artist.flashContributorContributions,
]
: []);
sortContributionsChronologically(
allContributions,
sortFlashesChronologically);
query.contribs =
chunkByConditions(allContributions, [
({thing: flash1}, {thing: flash2}) =>
flash1.act !== flash2.act,
]);
query.flashActs =
query.contribs
.map(contribs => contribs[0].thing)
.map(thing => thing.act);
return query;
},
relations: (relation, query, _sprawl, _artist) => ({
chunkedList:
relation('generateArtistInfoPageChunkedList'),
chunks:
stitchArrays({
flashAct: query.flashActs,
contribs: query.contribs,
}).map(({flashAct, contribs}) =>
relation('generateArtistInfoPageFlashesChunk', flashAct, contribs)),
}),
generate: (relations) =>
relations.chunkedList.slots({
chunks: relations.chunks,
}),
};
|