Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCODOC_R6A06
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Milleville
SCODOC_R6A06
Commits
4aa5c0e2
Commit
4aa5c0e2
authored
8 months ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
Améliore translate_calendar
parent
3c5cb3e5
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/scodoc/notesdb.py
+0
-26
0 additions, 26 deletions
app/scodoc/notesdb.py
app/scodoc/sco_edt_cal.py
+8
-9
8 additions, 9 deletions
app/scodoc/sco_edt_cal.py
app/scodoc/sco_utils.py
+12
-0
12 additions, 0 deletions
app/scodoc/sco_utils.py
with
20 additions
and
35 deletions
app/scodoc/notesdb.py
+
0
−
26
View file @
4aa5c0e2
...
...
@@ -514,32 +514,6 @@ def DateISOtoDMY(isodate):
return
"
%02d/%02d/%04d
"
%
(
day
,
month
,
year
)
def
TimetoISO8601
(
t
,
null_is_empty
=
False
)
->
str
:
"
convert time string to ISO 8601 (allow 16:03, 16h03, 16)
"
if
isinstance
(
t
,
datetime
.
time
):
return
t
.
isoformat
()
if
not
t
and
null_is_empty
:
return
""
t
=
t
.
strip
().
upper
().
replace
(
"
H
"
,
"
:
"
)
if
t
and
t
.
count
(
"
:
"
)
==
0
and
len
(
t
)
<
3
:
t
=
t
+
"
:00
"
return
t
def
TimefromISO8601
(
t
)
->
str
:
"
convert time string from ISO 8601 to our display format
"
if
not
t
:
return
t
# XXX strange bug turnaround...
try
:
t
=
"
%s:%s
"
%
(
t
.
hour
(),
t
.
minute
())
# log('TimefromISO8601: converted isotime to iso !')
except
:
pass
fs
=
str
(
t
).
split
(
"
:
"
)
return
fs
[
0
]
+
"
h
"
+
fs
[
1
]
# discard seconds
def
float_null_is_zero
(
x
):
if
x
is
None
or
x
==
""
:
return
0.0
...
...
This diff is collapsed.
Click to expand it.
app/scodoc/sco_edt_cal.py
+
8
−
9
View file @
4aa5c0e2
...
...
@@ -224,20 +224,19 @@ def translate_calendar(
modimpl
:
ModuleImpl
|
bool
=
event
[
"
modimpl
"
]
params
=
{
"
scodoc_dept
"
:
g
.
scodoc_dept
,
"
group_ids
"
:
group
.
id
,
"
heure_deb
"
:
event
[
"
heure_deb
"
].
replace
(
"
h
"
,
"
:
"
)
if
"
h
"
in
event
[
"
heure_deb
"
]
else
event
[
"
heure_deb
"
],
"
heure_fin
"
:
event
[
"
heure_fin
"
].
replace
(
"
h
"
,
"
:
"
)
if
"
h
"
in
event
[
"
heure_fin
"
]
else
event
[
"
heure_fin
"
],
"
day
"
:
event
[
"
jour
"
]
"
heure_deb
"
:
scu
.
heure_to_iso8601
(
event
[
"
heure_deb
"
]),
"
heure_fin
"
:
scu
.
heure_to_iso8601
(
event
[
"
heure_fin
"
]),
"
day
"
:
event
[
"
jour
"
],
}
if
group
:
params
[
"
group_ids
"
]
=
group
.
id
if
modimpl
:
params
[
"
moduleimpl_id
"
]
=
modimpl
.
id
elif
group
:
params
[
"
formsemestre_id
"
]
=
group
.
partition
.
formsemestre_id
url_abs
=
(
url_for
(
"
assiduites.signal_assiduites_group
"
,
**
params
)
if
group
else
None
url_for
(
"
assiduites.signal_assiduites_group
"
,
**
params
)
if
group
else
None
)
match
modimpl
:
case
False
:
# EDT non configuré
...
...
This diff is collapsed.
Click to expand it.
app/scodoc/sco_utils.py
+
12
−
0
View file @
4aa5c0e2
...
...
@@ -152,6 +152,18 @@ def convert_fr_date(
raise
ScoValueError
(
"
Date (j/m/a) invalide
"
)
def
heure_to_iso8601
(
t
,
null_is_empty
=
False
)
->
str
:
"
convert time string to ISO 8601 (allow 16:03, 16h03, 16)
"
if
isinstance
(
t
,
datetime
.
time
):
return
t
.
isoformat
()
if
not
t
and
null_is_empty
:
return
""
t
=
t
.
strip
().
upper
().
replace
(
"
H
"
,
"
:
"
)
if
t
and
t
.
count
(
"
:
"
)
==
0
and
len
(
t
)
<
3
:
t
=
t
+
"
:00
"
return
t
def
print_progress_bar
(
iteration
,
total
,
...
...
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