Skip to content

Commit

Permalink
Merge pull request #4600 from carlobeltrame/schedule-entry-number-cle…
Browse files Browse the repository at this point in the history
…anup

Schedule entry number cleanup
  • Loading branch information
carlobeltrame committed Feb 24, 2024
2 parents 5e84319 + 1f11424 commit 403b261
Show file tree
Hide file tree
Showing 7 changed files with 2,240 additions and 2,243 deletions.
5 changes: 3 additions & 2 deletions api/src/Entity/ScheduleEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ public function getDayNumber(): int {

/**
* The cardinal number of this schedule entry, when chronologically ordering all
* schedule entries that start on the same day. I.e. if the schedule entry is the
* second entry on a given day, its number will be 2.
* schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
* the schedule entry is the second entry with roman numbering on a given day, its
* number will be 2.
*/
#[ApiProperty(example: '2')]
#[Groups(['read'])]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15395,8 +15395,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -15482,8 +15483,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -15570,8 +15572,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -15660,8 +15663,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -15860,8 +15864,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -15947,8 +15952,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -16035,8 +16041,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -16134,8 +16141,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -16310,8 +16318,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -16420,8 +16429,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -16531,8 +16541,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down Expand Up @@ -16644,8 +16655,9 @@ components:
scheduleEntryNumber:
description: |-
The cardinal number of this schedule entry, when chronologically ordering all
schedule entries that start on the same day. I.e. if the schedule entry is the
second entry on a given day, its number will be 2.
schedule entries WITH THE SAME NUMBERING STYLE that start on the same day. I.e. if
the schedule entry is the second entry with roman numbering on a given day, its
number will be 2.
example: '2'
readOnly: true
type: integer
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/components/story/StoryDay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
</v-expansion-panel>
</template>
<script>
import { sortBy } from 'lodash'
import ApiForm from '@/components/form/api/ApiForm.vue'
import { dateHelperUTCFormatted } from '@/mixins/dateHelperUTCFormatted.js'
import CategoryChip from '@/components/generic/CategoryChip.vue'
Expand All @@ -79,11 +78,8 @@ export default {
return scheduleEntry.day()._meta.self === this.day._meta.self
})
},
sortedScheduleEntries() {
return sortBy(this.scheduleEntries, (scheduleEntry) => scheduleEntry.start)
},
entries() {
return this.sortedScheduleEntries.map((scheduleEntry) => ({
return this.scheduleEntries.map((scheduleEntry) => ({
scheduleEntry: scheduleEntry,
storyChapters: this.periodStoryChapters.filter(
(contentNode) =>
Expand Down
10 changes: 3 additions & 7 deletions pdf/src/campPrint/program/ProgramPeriod.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
>{{ $tc('print.program.title') }}: {{ period.description }}</Text
>
<ScheduleEntry
v-for="scheduleEntry in sortedScheduleEntries"
v-for="scheduleEntry in scheduleEntries"
:id="`${id}-${period.id}-${scheduleEntry.id}`"
:schedule-entry="scheduleEntry"
/>
</template>
<script>
import PdfComponent from '@/PdfComponent.js'
import ScheduleEntry from '../scheduleEntry/ScheduleEntry.vue'
import sortBy from 'lodash/sortBy.js'
export default {
name: 'ProgramPeriod',
Expand All @@ -24,11 +23,8 @@ export default {
period: { type: Object, required: true },
},
computed: {
sortedScheduleEntries() {
return sortBy(this.period.scheduleEntries().items, [
'dayNumber',
'scheduleEntryNumber',
])
scheduleEntries() {
return this.period.scheduleEntries().items
},
},
}
Expand Down
14 changes: 5 additions & 9 deletions pdf/src/campPrint/story/StoryDay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import PdfComponent from '@/PdfComponent.js'
import { dateLong } from '../../../common/helpers/dateHelperUTCFormatted.js'
import CategoryLabel from '../CategoryLabel.vue'
import RichText from '../RichText.vue'
import sortBy from 'lodash/sortBy.js'
import { isEmptyHtml } from '../helpers.js'
export default {
Expand All @@ -40,16 +39,13 @@ export default {
date() {
return dateLong(this.day.start, this.$tc)
},
sortedScheduleEntries() {
return sortBy(
this.period.scheduleEntries().items.filter((scheduleEntry) => {
return scheduleEntry.day()._meta.self === this.day._meta.self
}),
(scheduleEntry) => scheduleEntry.start
)
scheduleEntries() {
return this.period.scheduleEntries().items.filter((scheduleEntry) => {
return scheduleEntry.day()._meta.self === this.day._meta.self
})
},
entries() {
return this.sortedScheduleEntries.map((scheduleEntry) => ({
return this.scheduleEntries.map((scheduleEntry) => ({
scheduleEntry,
storyChapters: this.period
.contentNodes()
Expand Down
6 changes: 1 addition & 5 deletions pdf/src/campPrint/tableOfContents/entry/ProgramPeriod.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
</template>
<script>
import PdfComponent from '@/PdfComponent.js'
import sortBy from 'lodash/sortBy.js'
export default {
name: 'Program',
Expand All @@ -31,10 +30,7 @@ export default {
return this.period.scheduleEntries().items.length
},
scheduleEntries() {
return sortBy(this.period.scheduleEntries().items, [
'dayNumber',
'scheduleEntryNumber',
]).map((scheduleEntry) => {
return this.period.scheduleEntries().items.map((scheduleEntry) => {
const activity = scheduleEntry.activity()
return {
...scheduleEntry,
Expand Down

0 comments on commit 403b261

Please sign in to comment.