Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Alsijil
Commits
7eca340e
Commit
7eca340e
authored
1 month ago
by
permcu
Browse files
Options
Downloads
Patches
Plain Diff
Reformat
parent
c48942a4
No related branches found
Branches containing commit
No related tags found
1 merge request
!464
Resolve "Allow using time slot numbers in long term absences dialog (instead of datetimes)"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/frontend/components/coursebook/absences/AbsenceCreationForm.vue
+34
-31
34 additions, 31 deletions
...nd/components/coursebook/absences/AbsenceCreationForm.vue
aleksis/apps/alsijil/schema/__init__.py
+11
-4
11 additions, 4 deletions
aleksis/apps/alsijil/schema/__init__.py
with
45 additions
and
35 deletions
aleksis/apps/alsijil/frontend/components/coursebook/absences/AbsenceCreationForm.vue
+
34
−
31
View file @
7eca340e
...
...
@@ -34,15 +34,15 @@
/>
</div>
</v-col>
<v-col
cols=
"12"
:sm=
"2"
v-if=
"startPeriods"
align-self=
"end"
>
<v-select
:label=
"$t('lesrooster.slot.period')"
:items=
"startPeriods"
item-text=
"period"
:value=
"startSlot"
@
input=
"handleStartSlot"
return-object
/>
<v-col
cols=
"12"
:sm=
"2"
v-if=
"startPeriods"
align-self=
"end"
>
<v-select
:label=
"$t('lesrooster.slot.period')"
:items=
"startPeriods"
item-text=
"period"
:value=
"startSlot"
@
input=
"handleStartSlot"
return-object
/>
</v-col>
<v-col
cols=
"12"
:sm=
"endPeriods ? 4 : 6"
class=
"pr-0"
>
<div
aria-required=
"true"
>
...
...
@@ -55,14 +55,14 @@
</div>
</v-col>
<v-col
cols=
"12"
:sm=
"2"
v-if=
"endPeriods"
align-self=
"end"
>
<v-select
:label=
"$t('lesrooster.slot.period')"
:items=
"endPeriods"
item-text=
"period"
:value=
"endSlot"
@
input=
"handleEndSlot"
return-object
/>
<v-select
:label=
"$t('lesrooster.slot.period')"
:items=
"endPeriods"
item-text=
"period"
:value=
"endSlot"
@
input=
"handleEndSlot"
return-object
/>
</v-col>
</v-row>
<v-row>
...
...
@@ -89,10 +89,7 @@
<
script
>
import
AbsenceReasonGroupSelect
from
"
aleksis.apps.kolego/components/AbsenceReasonGroupSelect.vue
"
;
import
DateTimeField
from
"
aleksis.core/components/generic/forms/DateTimeField.vue
"
;
import
{
periodsByDay
,
persons
,
}
from
"
./absenceCreation.graphql
"
;
import
{
periodsByDay
,
persons
}
from
"
./absenceCreation.graphql
"
;
import
formRulesMixin
from
"
aleksis.core/mixins/formRulesMixin.js
"
;
import
{
DateTime
}
from
"
luxon
"
;
...
...
@@ -188,20 +185,24 @@ export default {
getPeriodsForWeekday
(
weekday
)
{
// Adapt from python conventions
const
pythonWeekday
=
weekday
-
1
;
return
this
.
periodsByDay
.
find
((
period
)
=>
period
.
weekday
===
pythonWeekday
).
periods
;
return
this
.
periodsByDay
.
find
(
(
period
)
=>
period
.
weekday
===
pythonWeekday
,
).
periods
;
},
handleStartDate
(
date
)
{
console
.
log
(
"
handleStartDate
"
,
date
);
this
.
start
=
DateTime
.
fromISO
(
date
);
if
(
this
.
periodsByDay
.
length
>
0
)
{
// Select periods for day
this
.
startPeriods
=
this
.
getPeriodsForWeekday
(
this
.
start
.
weekday
);
// Sync PeriodSelect
const
startTime
=
this
.
start
.
toFormat
(
"
HH:mm:ss
"
)
console
.
log
(
"
syncing to
"
,
startTime
)
this
.
startSlot
=
this
.
startPeriods
.
find
((
period
)
=>
period
.
timeStart
===
startTime
)
console
.
log
(
"
startSlot
"
,
this
.
startSlot
)
const
startTime
=
this
.
start
.
toFormat
(
"
HH:mm:ss
"
);
console
.
log
(
"
syncing to
"
,
startTime
);
this
.
startSlot
=
this
.
startPeriods
.
find
(
(
period
)
=>
period
.
timeStart
===
startTime
,
);
console
.
log
(
"
startSlot
"
,
this
.
startSlot
);
}
},
handleEndDate
(
date
)
{
...
...
@@ -211,13 +212,15 @@ export default {
// Select periods for day
this
.
endPeriods
=
this
.
getPeriodsForWeekday
(
this
.
end
.
weekday
);
// Sync PeriodSelect
const
endTime
=
this
.
end
.
toFormat
(
"
HH:mm:ss
"
)
this
.
endSlot
=
this
.
endPeriods
.
find
((
period
)
=>
period
.
endTime
===
endTime
)
const
endTime
=
this
.
end
.
toFormat
(
"
HH:mm:ss
"
);
this
.
endSlot
=
this
.
endPeriods
.
find
(
(
period
)
=>
period
.
endTime
===
endTime
,
);
}
},
handleStartSlot
(
slot
)
{
// Sync TimeSelect
const
startTime
=
DateTime
.
fromISO
(
slot
.
timeStart
)
const
startTime
=
DateTime
.
fromISO
(
slot
.
timeStart
)
;
this
.
start
=
this
.
start
.
set
({
hour
:
startTime
.
hour
,
minute
:
startTime
.
minute
,
...
...
@@ -226,7 +229,7 @@ export default {
},
handleEndSlot
(
slot
)
{
// Sync TimeSelect
const
endTime
=
DateTime
.
fromISO
(
slot
.
timeEnd
)
const
endTime
=
DateTime
.
fromISO
(
slot
.
timeEnd
)
;
this
.
end
=
this
.
end
.
set
({
hour
:
endTime
.
hour
,
minute
:
endTime
.
minute
,
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/schema/__init__.py
+
11
−
4
View file @
7eca340e
from
datetime
import
datetime
from
collections
import
defaultdict
from
datetime
import
datetime
from
django.db.models
import
BooleanField
,
ExpressionWrapper
,
Q
from
django.apps
import
apps
from
django.db.models
import
BooleanField
,
ExpressionWrapper
,
Q
import
graphene
import
graphene_django_optimizer
...
...
@@ -366,7 +366,11 @@ class Query(graphene.ObjectType):
if
apps
.
is_installed
(
"
aleksis.apps.lesrooster
"
):
Slot
=
apps
.
get_model
(
"
lesrooster
"
,
"
Slot
"
)
ValidityRange
=
apps
.
get_model
(
"
lesrooster
"
,
"
ValidityRange
"
)
slots
=
Slot
.
objects
.
filter
(
time_grid__validity_range
=
ValidityRange
.
current
).
order_by
(
"
weekday
"
).
values
(
"
weekday
"
,
"
period
"
,
"
time_start
"
,
"
time_end
"
)
slots
=
(
Slot
.
objects
.
filter
(
time_grid__validity_range
=
ValidityRange
.
current
)
.
order_by
(
"
weekday
"
)
.
values
(
"
weekday
"
,
"
period
"
,
"
time_start
"
,
"
time_end
"
)
)
# Key by weekday
by_weekday
=
defaultdict
(
list
)
for
slot
in
slots
:
...
...
@@ -376,12 +380,15 @@ class Query(graphene.ObjectType):
# Nest and sort periods
periods
=
[]
for
weekday
,
slots
in
by_weekday
.
items
():
periods
.
append
({
"
weekday
"
:
weekday
,
"
periods
"
:
sorted
(
slots
,
key
=
lambda
slot
:
slot
[
"
period
"
])})
periods
.
append
(
{
"
weekday
"
:
weekday
,
"
periods
"
:
sorted
(
slots
,
key
=
lambda
slot
:
slot
[
"
period
"
])}
)
return
periods
else
:
return
[]
class
Mutation
(
graphene
.
ObjectType
):
create_or_update_documentations
=
DocumentationBatchCreateOrUpdateMutation
.
Field
()
touch_documentation
=
TouchDocumentationMutation
.
Field
()
...
...
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