Skip to content

Commit d35f8d5

Browse files
authored
Upgrade techevent (#11)
* Update techevent to version 1.0.0a19 * Modifica a cor de fundo para um tom de cinza mais claro. * Lint fixes
1 parent 0358d0e commit d35f8d5

File tree

12 files changed

+1217
-1143
lines changed

12 files changed

+1217
-1143
lines changed

backend/news/+techevent.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade collective.techevent to 1.0.0a19. @ericof

backend/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies = [
3232
"collective.volto.formsupport",
3333
"pas.plugins.authomatic==2.0.0",
3434
"collective.honeypot",
35-
"collective.techevent==1.0.0a18",
35+
"collective.techevent==1.0.0a19",
3636
"plone.app.upgrade",
3737
"plone.app.discussion",
3838
]
@@ -105,7 +105,7 @@ constraint-dependencies = [
105105
"collective.recipe.omelette==2.0.0",
106106
"collective.recipe.template==2.2",
107107
"collective.recipe.vscode==0.1.9",
108-
"collective.techevent==1.0.0a18",
108+
"collective.techevent==1.0.0a19",
109109
"collective.xmltestreport==2.0.2",
110110
"collective.z3cform.datagridfield==3.0.4",
111111
"colorama==0.4.6",

backend/src/pythonbrasil/site/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,12 @@
1212
_ = MessageFactory(PACKAGE_NAME)
1313

1414
logger = logging.getLogger(PACKAGE_NAME)
15+
16+
17+
def run_patches():
18+
from pythonbrasil.site.patch import apply_patches
19+
20+
apply_patches()
21+
22+
23+
run_patches()
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from copy import deepcopy
2+
from datetime import timedelta
3+
from dateutil.parser import parse
4+
from pythonbrasil.site import logger
5+
6+
7+
def patch_process_trainings():
8+
from collective.techevent.services.schedule import get
9+
10+
def process_trainings(slots: list[dict]) -> list[dict]:
11+
"""Break whole day training sessions as 2 slots."""
12+
slot_limit = 14400 # 4 hours
13+
lunch_break = 60 * 60 * 1 # 1 hour lunch break
14+
response = []
15+
for slot in slots:
16+
raw_start = slot["start"]
17+
raw_end = slot["end"]
18+
if slot.get("@type") != "Training" or not (raw_start and raw_end):
19+
response.append(slot)
20+
continue
21+
start = parse(raw_start)
22+
end = parse(raw_end)
23+
if (total_duration := (end - start).seconds) > slot_limit:
24+
# change the first slot end
25+
slot_end = start + timedelta(seconds=slot_limit)
26+
slot["end"] = slot_end.isoformat()
27+
response.append(slot)
28+
slot = deepcopy(slot)
29+
# change the second slot start
30+
new_start = slot_end + timedelta(seconds=lunch_break)
31+
slot["start"] = new_start.isoformat()
32+
slot_end = new_start + timedelta(seconds=(total_duration - slot_limit))
33+
slot["end"] = slot_end.isoformat()
34+
response.append(slot)
35+
else:
36+
response.append(slot)
37+
return response
38+
39+
# Make a reference the original function
40+
get._original_process_trainings = get.process_trainings
41+
# Replace the original function with the patched one
42+
get.process_trainings = process_trainings
43+
logger.info("Patched collective.techevent.services.schedule.get.process_trainings")
44+
45+
46+
def apply_patches():
47+
patch_process_trainings()
48+
logger.info("All patches applied.")

backend/uv.lock

Lines changed: 1134 additions & 1134 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Modifica a cor de fundo para um tom de cinza mais claro. @ericof
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade @plone-collective/volto-techevent to 1.0.0-alpha.19. @ericof

frontend/packages/volto-pythonbrasil-site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@plone/registry": "workspace:*",
4949
"@eeacms/volto-matomo": "*",
5050
"@eeacms/volto-statistic-block": "*",
51-
"@plone-collective/volto-techevent": "1.0.0-alpha.18",
51+
"@plone-collective/volto-techevent": "1.0.0-alpha.19",
5252
"@kitconcept/volto-light-theme": "7.0.0-alpha.22",
5353
"@kitconcept/volto-social-blocks": "1.0.0-alpha.8",
5454
"@mbarde/volto-image-crop-widget": "0.5.1",

frontend/packages/volto-pythonbrasil-site/src/theme/_main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
@import 'blocks/listing';
2525
@import 'blocks/search';
2626
@import 'blocks/slider';
27+
@import 'blocks/schedule';
2728
@import 'blocks/chamada';
2829
@import 'blocks/image';
2930
@import 'blocks/block_sponsorlevel';

frontend/packages/volto-pythonbrasil-site/src/theme/_root.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
--link-color: var(--text-color);
4040
--link-foreground-color: var(--link-color);
4141

42-
--background-color: #c3c8ca;
42+
--background-color: #d3d8da;
4343

4444
// Components
4545
--social-network-icon-color-main: var(--secondary-color);

0 commit comments

Comments
 (0)