Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pruefungseinsicht-calendly-export
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
Container 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Raphael Das Gupta
pruefungseinsicht-calendly-export
Commits
c7f20351
Commit
c7f20351
authored
4 years ago
by
Florian Bruhin
Browse files
Options
Downloads
Patches
Plain Diff
Add cancelled
parent
410a64f8
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
export.py
+24
-7
24 additions, 7 deletions
export.py
with
24 additions
and
7 deletions
export.py
+
24
−
7
View file @
c7f20351
...
...
@@ -3,9 +3,10 @@ import collections
import
pathlib
import
argparse
import
dataclasses
from
typing
import
List
,
Dict
from
typing
import
List
,
Dict
,
Optional
import
openpyxl
import
openpyxl.styles
@dataclasses.dataclass
...
...
@@ -15,9 +16,13 @@ class Signup:
firstname
:
str
exams
:
str
email
:
str
cancelled
:
Optional
[
str
]
=
None
def
row_data
(
self
):
return
(
self
.
lastname
,
self
.
firstname
,
self
.
exams
,
self
.
email
)
data
=
[
self
.
lastname
,
self
.
firstname
,
self
.
exams
,
self
.
email
]
if
self
.
cancelled
is
not
None
:
data
.
append
(
f
'
Storniert:
{
self
.
cancelled
}
'
)
return
data
def
process
(
reader
:
csv
.
reader
)
->
Dict
[
str
,
List
[
Signup
]]:
...
...
@@ -40,16 +45,17 @@ def process(reader: csv.reader) -> Dict[str, List[Signup]]:
firstname
=
line
[
'
Invitee First Name
'
]
email
=
line
[
'
Invitee Email
'
]
if
line
[
'
Canceled
'
]
==
'
true
'
:
print
(
f
"
Cancelled:
{
lastname
}
{
firstname
}
for
{
slot
}
"
)
continue
if
not
firstname
or
not
lastname
:
print
(
f
"
!!! WRONG NAME:
{
lastname
}
{
firstname
}
{
email
}
for
{
slot
}
{
exams
}
"
)
if
not
exams
:
print
(
f
"
!!! NO EXAMS:
{
lastname
}
{
firstname
}
{
email
}
for
{
slot
}
"
)
event_data
[
slot
].
append
(
Signup
(
lastname
,
firstname
,
'
'
.
join
(
exams
),
email
))
signup
=
Signup
(
lastname
,
firstname
,
'
'
.
join
(
exams
),
email
)
if
line
[
'
Canceled
'
]
==
'
true
'
:
print
(
f
"
Cancelled:
{
lastname
}
{
firstname
}
for
{
slot
}
"
)
signup
.
cancelled
=
line
[
'
Cancellation reason
'
]
event_data
[
slot
].
append
(
signup
)
return
event_data
...
...
@@ -59,6 +65,7 @@ def _resize_cols(sheet: openpyxl.worksheet.worksheet.Worksheet) -> None:
'
B
'
:
20
,
'
C
'
:
50
,
'
D
'
:
30
,
'
E
'
:
50
,
}
for
col
,
dim
in
dimensions
.
items
():
sheet
.
column_dimensions
[
col
].
width
=
dim
...
...
@@ -70,6 +77,16 @@ def writeout(event_data: Dict[str, List[Signup]], path: pathlib.Path) -> None:
sheet
=
workbook
.
create_sheet
(
title
=
slot
.
replace
(
'
:
'
,
'
.
'
))
for
signup
in
data
:
sheet
.
append
(
list
(
signup
.
row_data
()))
if
signup
.
cancelled
is
not
None
:
for
tpl
in
sheet
.
iter_cols
(
min_row
=
sheet
.
max_row
):
assert
len
(
tpl
)
==
1
,
tpl
cell
=
tpl
[
0
]
assert
cell
.
row
==
sheet
.
max_row
,
cell
cell
.
font
=
openpyxl
.
styles
.
Font
(
color
=
"
FF0000
"
,
strike
=
cell
.
column
!=
sheet
.
max_column
,
)
_resize_cols
(
sheet
)
del
workbook
[
'
Sheet
'
]
...
...
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