Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
site-kwei
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
aeltheos
site-kwei
Commits
ca426b4d
Commit
ca426b4d
authored
3 years ago
by
Dorian Lesbre
Browse files
Options
Downloads
Patches
Plain Diff
Added optional slot duration+fix
planning bug
parent
c9d14009
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
home/migrations/0006_interludesslot_duration.py
+18
-0
18 additions, 0 deletions
home/migrations/0006_interludesslot_duration.py
home/models.py
+8
-5
8 additions, 5 deletions
home/models.py
with
26 additions
and
5 deletions
home/migrations/0006_interludesslot_duration.py
0 → 100644
+
18
−
0
View file @
ca426b4d
# Generated by Django 3.0.8 on 2021-04-30 11:56
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
home
'
,
'
0005_auto_20210425_1539
'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'
interludesslot
'
,
name
=
'
duration
'
,
field
=
models
.
DurationField
(
blank
=
True
,
help_text
=
"
Format 00:00:00. Laisser vide pour prendre la durée de l
'
activité correspondante
"
,
null
=
True
,
verbose_name
=
'
durée
'
),
),
]
This diff is collapsed.
Click to expand it.
home/models.py
+
8
−
5
View file @
ca426b4d
...
...
@@ -143,6 +143,10 @@ class InterludesSlot(models.Model):
TITLE_SPECIFIER
),
)
start
=
models
.
DateTimeField
(
"
début
"
)
duration
=
models
.
DurationField
(
"
durée
"
,
blank
=
True
,
null
=
True
,
help_text
=
"
Format 00:00:00. Laisser vide pour prendre la durée de l
'
activité correspondante
"
)
room
=
models
.
CharField
(
"
salle
"
,
max_length
=
100
,
null
=
True
,
blank
=
True
)
on_planning
=
models
.
BooleanField
(
"
afficher sur le planning
"
,
default
=
False
,
...
...
@@ -162,6 +166,8 @@ class InterludesSlot(models.Model):
@property
def
end
(
self
):
"""
Heure de fin du créneau
"""
if
self
.
duration
:
return
self
.
start
+
self
.
duration
return
self
.
start
+
self
.
activity
.
duration
def
conflicts
(
self
,
other
:
"
InterludesSlot
"
)
->
bool
:
...
...
@@ -192,7 +198,7 @@ class InterludesSlot(models.Model):
if
settings
.
date_start
:
time
=
date
.
timetz
()
offset
=
datetime
.
timedelta
(
0
)
if
time
.
hour
<
=
4
:
if
time
.
hour
<
4
:
offset
=
datetime
.
timedelta
(
days
=
1
)
return
timezone
.
datetime
.
combine
(
settings
.
date_start
+
offset
,
...
...
@@ -216,10 +222,7 @@ class InterludesSlot(models.Model):
@property
def
planning_end
(
self
)
->
int
:
end
=
self
.
fake_date
(
self
.
end
)
if
end
and
end
<=
self
.
planning_start
:
end
+=
datetime
.
timedelta
(
days
=
1
)
return
end
return
self
.
fake_date
(
self
.
end
)
def
__str__
(
self
)
->
str
:
return
self
.
title
.
replace
(
self
.
TITLE_SPECIFIER
,
self
.
activity
.
title
)
...
...
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