Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
dashboard
Commits
46bfda46
Commit
46bfda46
authored
1 year ago
by
Konrad Mohrfeldt
Browse files
Options
Downloads
Patches
Plain Diff
refactor: use API to exclude irrelevant schedules
parent
1201a518
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/shows/ScheduleList.vue
+11
-27
11 additions, 27 deletions
src/components/shows/ScheduleList.vue
with
11 additions
and
27 deletions
src/components/shows/ScheduleList.vue
+
11
−
27
View file @
46bfda46
...
@@ -20,13 +20,9 @@
...
@@ -20,13 +20,9 @@
</thead>
</thead>
<tbody>
<tbody>
<ScheduleRow
<ScheduleRow
v-for=
"schedule in result.items"
:key=
"schedule.id"
:schedule=
"schedule"
/>
v-for=
"schedule in relevantSchedules"
:key=
"schedule.id"
:schedule=
"schedule"
/>
<tr
v-if=
"re
levantSchedules.length
=== 0"
>
<tr
v-if=
"re
sult.count
=== 0"
>
<td
colspan=
"4"
>
<td
colspan=
"4"
>
<p
class=
"tw-text-center tw-py-3 tw-m-0"
>
<p
class=
"tw-text-center tw-py-3 tw-m-0"
>
{{
t
(
'
showSchedules.noSchedulesAvailable
'
)
}}
{{
t
(
'
showSchedules.noSchedulesAvailable
'
)
}}
...
@@ -40,14 +36,14 @@
...
@@ -40,14 +36,14 @@
</
template
>
</
template
>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
parseISO
}
from
'
date-fns
'
import
{
computed
}
from
'
vue
'
import
{
usePaginatedList
}
from
'
@rokoli/bnb/drf
'
import
{
usePaginatedList
}
from
'
@rokoli/bnb/drf
'
import
{
useI18n
}
from
'
@/i18n
'
import
{
useI18n
}
from
'
@/i18n
'
import
{
Schedule
,
Show
}
from
'
@/types
'
import
ASection
from
'
@/components/generic/ASection.vue
'
import
{
useScheduleStore
}
from
'
@/stores/schedules
'
import
{
useScheduleStore
}
from
'
@/stores/schedules
'
import
{
Show
}
from
'
@/types
'
import
{
useQuery
}
from
'
@/util
'
import
ASection
from
'
@/components/generic/ASection.vue
'
import
ScheduleRow
from
'
./ScheduleRow.vue
'
import
ScheduleRow
from
'
./ScheduleRow.vue
'
defineOptions
({
compatConfig
:
{
MODE
:
3
}
})
defineOptions
({
compatConfig
:
{
MODE
:
3
}
})
...
@@ -58,22 +54,10 @@ const props = defineProps<{
...
@@ -58,22 +54,10 @@ const props = defineProps<{
const
{
t
}
=
useI18n
()
const
{
t
}
=
useI18n
()
const
scheduleStore
=
useScheduleStore
()
const
scheduleStore
=
useScheduleStore
()
const
{
result
:
schedule
}
=
usePaginatedList
(
scheduleStore
.
listIsolated
,
1
,
100
,
{
const
{
result
}
=
usePaginatedList
(
scheduleStore
.
listIsolated
,
1
,
100
,
{
query
:
()
=>
new
URLSearchParams
({
showIds
:
props
.
show
.
id
.
toString
()
}),
query
:
useQuery
(()
=>
({
showIds
:
props
.
show
.
id
,
excludeInactive
:
'
1
'
,
})),
})
})
const
relevantSchedules
=
computed
(()
=>
schedule
.
value
.
items
.
filter
((
s
)
=>
!
isPossiblyPastSchedule
(
s
)),
)
function
isPossiblyPastSchedule
(
schedule
:
Schedule
)
{
// Recurrence rules get complex very fast, so we only give
// a definitive answer if a lastDate is set for this schedule.
if
(
!
schedule
.
lastDate
)
{
return
false
}
const
lastDate
=
parseISO
(
schedule
.
lastDate
)
const
[
hours
,
minutes
,
seconds
]
=
(
schedule
.
endTime
??
'
00:00:00
'
).
split
(
'
:
'
)
lastDate
.
setHours
(
parseInt
(
hours
??
'
0
'
),
parseInt
(
minutes
??
'
0
'
),
parseInt
(
seconds
??
'
0
'
))
return
new
Date
()
>
lastDate
}
</
script
>
</
script
>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment