Skip to content

Commit

Permalink
Merge pull request #4939 from carlobeltrame/fix-story-printing-periods
Browse files Browse the repository at this point in the history
Fix story printing when there are multiple periods
  • Loading branch information
usu committed Apr 13, 2024
2 parents f04f30c + 3dc1c23 commit e18b379
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
4 changes: 1 addition & 3 deletions frontend/src/views/camp/Story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ export default {
{
type: 'Story',
options: {
periods: this.camp()
.periods()
.items.map((period) => period._meta.self),
periods: [this.period()._meta.self],
},
},
],
Expand Down
43 changes: 23 additions & 20 deletions print/components/story/StoryPeriod.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,30 @@ const props = defineProps({
const { $api } = useNuxtApp()
const { data, error } = await useAsyncData('StoryPeriod', async () => {
const contentTypeStorycontext = (
await $api.get().contentTypes().$loadItems()
).items.find((contentType) => contentType.name === 'Storycontext')
const { data, error } = await useAsyncData(
`StoryPeriod-${props.period._meta.self}`,
async () => {
const contentTypeStorycontext = (
await $api.get().contentTypes().$loadItems()
).items.find((contentType) => contentType.name === 'Storycontext')
const [periodStoryChapters] = await Promise.all([
$api
.get()
.contentNodes({
period: props.period._meta.self,
contentType: contentTypeStorycontext._meta.self,
})
.$loadItems(),
props.period.days().$loadItems(),
props.period.scheduleEntries().$loadItems(),
props.period.camp().categories().$loadItems(),
])
const [periodStoryChapters] = await Promise.all([
$api
.get()
.contentNodes({
period: props.period._meta.self,
contentType: contentTypeStorycontext._meta.self,
})
.$loadItems(),
props.period.days().$loadItems(),
props.period.scheduleEntries().$loadItems(),
props.period.camp().categories().$loadItems(),
])
return {
days: props.period.days().items,
periodStoryChapters: periodStoryChapters.items,
return {
days: props.period.days().items,
periodStoryChapters: periodStoryChapters.items,
}
}
})
)
</script>

0 comments on commit e18b379

Please sign in to comment.