Commit a1795585 authored by Dorian's avatar Dorian
Browse files

added end of incident indicator

parent 9aaef55b
......@@ -53,7 +53,7 @@ li{
/* cluster table summary */
.cluster table.summary{
border-spacing: 0;
/* border-collapse: collapse; */
border-collapse: collapse;
width: 100%;
}
.cluster table.summary th{
......@@ -163,6 +163,20 @@ ul.attachments .date{
text-align: right;
}
/* indicator of the end of an incident */
.potelet > footer{
margin-top: 0.5em;
text-align: right;
}
.potelet > footer::after{
content: "";
display: inline-block;
width: 1em;
height: 1em;
background: transparent;
border: 1pt solid black;
}
/* ___ COMMENTS STYLING ___*/
ul.attachments .comment .text{
......@@ -243,7 +257,7 @@ ul.attachments img{
height: auto;
/* l'image est rogner si trop haute ! */
max-height: calc(calc(var(--pagedjs-pagebox-height) - calc(var(--pagedjs-margin-top) + var(--pagedjs-margin-bottom))) - 4.5em);
max-height: calc(calc(var(--pagedjs-pagebox-height) - calc(var(--pagedjs-margin-top) + var(--pagedjs-margin-bottom))) - 6em);
object-fit: cover;
object-position: center;
}
......@@ -196,6 +196,7 @@ need a wrapper anymore*/
.potelet > footer{
counter-increment: potelet;
}
/* TODO: separation entre les potelets sur le format A3 landscape*/
.potelet:not([data-split-original="true"])::after{
/* content: "";
......@@ -208,6 +209,7 @@ need a wrapper anymore*/
}
.potelet h4{
break-after: avoid;
-webkit-column-break-after: avoid;
}
.potelet.empty-content + .potelet.empty-content{
......@@ -219,4 +221,5 @@ need a wrapper anymore*/
/* ATTACHMENTS */
ul.attachments li{
break-inside: avoid;
-webkit-column-break-inside: avoid;
}
This diff is collapsed.
......@@ -204,7 +204,7 @@
<!-- <h4>attachments</h4> -->
{% for attachment in potelet.attachments %}
{% if attachment.first == 'first-after-initial-posts' %}
{% if attachment.firstafterinitial %}
<h4>after initial posts</h4>
{% endif %}
{% if attachment.type == 'PICTURE' %}
......
......@@ -30,8 +30,14 @@ def format_actor(actor_type, organisation, department):
print("ERROR: empty actor")
return actor
def is_first_post(attachment, first_actor, first_date):
return attachment["actor"] == first_actor and attachment["date"]["day"] == first_date["day"]
def print_if_long_case(potelet):
# interesting case?
creationDate = datetime.datetime.strptime(potelet["creationDate"]["day"], '%d.%m.%Y')
updatedDate = datetime.datetime.strptime(potelet["updatedDate"]["day"], '%d.%m.%Y')
year = (updatedDate - creationDate).days
if year >= 365:
if len(potelet["attachments"])>4:
print(potelet["id"], year)
def sort_attachment(potelet):
#resort attachment in a way that for each day/actor we first have all the text,
......@@ -62,6 +68,29 @@ def sort_attachment(potelet):
return attachments
def detect_if_has_content(potelet):
has_img_or_txt = False
for attachment in potelet["attachments"]:
type = attachment["type"]
if type == "COMMENT" or type == "PICTURE":
has_img_or_txt = True
return has_img_or_txt
def detect_first_after_initial(potelet):
if potelet["attachments"] != []:
first_attachment = potelet["attachments"][0]
first_actor = first_attachment["actor"]
first_date = first_attachment["date"]
first_posts = True;
i = 0
while first_posts and i < len(potelet["attachments"]):
attachment = potelet["attachments"][i]
first_posts = (attachment["actor"] == first_actor and attachment["date"]["day"] == first_date["day"])
i += 1
if not first_posts:
attachment["firstafterinitial"] = True
def formatingPotelet(potelet):
......@@ -73,53 +102,35 @@ def formatingPotelet(potelet):
potelet["updatedDate"] = format_date(potelet["updatedDate"])
potelet["creationDate"] = format_date(potelet["creationDate"])
# interesting case?
creationDate = datetime.datetime.strptime(potelet["creationDate"]["day"], '%d.%m.%Y')
updatedDate = datetime.datetime.strptime(potelet["updatedDate"]["day"], '%d.%m.%Y')
year = (updatedDate - creationDate).days
if year >= 365:
if len(potelet["attachments"])>4:
print(potelet["id"], year)
# print_if_long_case(potelet)
# add link to the original website
potelet["url"] = URL + str(potelet["id"])
potelet["actor"] = format_actor("", potelet["responsibleOrganisation"], potelet["responsibleDepartment"])
has_img_or_txt = "empty-content"
# format attachment
if potelet["attachments"] != []:
for attachment in potelet["attachments"]:
attachment["date"] = format_date(attachment["date"])
attachment["actor"] = format_actor(attachment["actor_type"], attachment["organisation"], attachment["department"])
# detect if has content
type = attachment["type"]
if type == "COMMENT" or type == "PICTURE":
has_img_or_txt = "has-content"
potelet["img_or_txt"] = has_img_or_txt
# format history
for story in potelet["history"]:
story["date"] = format_date(story["date"])
story["actor"] = format_actor(story["actor_type"], story["organisation"], story["department"])
# sort attachment by day
potelet["attachments"] = sort_attachment(potelet)
# add a class to the potelet without COMMNENTS or PICTURES
potelet["img_or_txt"] = "" if detect_if_has_content(potelet) else "empty-content"
# detect first post after
first_attachment = potelet["attachments"][0]
first_actor = first_attachment["actor"]
first_date = first_attachment["date"]
first_posts = True;
for attachment in potelet["attachments"]:
# we switch after the last first post
if first_posts and not is_first_post(attachment, first_actor, first_date):
attachment["first"] = "first-after-initial-posts"
first_posts = False;
else:
attachment["first"] = ""
# sort attachment with for each day first the COMMENTS then the PICTURES
# in order to win some space while conserving chronology
potelet["attachments"] = sort_attachment(potelet)
# detect the first post after the "initial one"
# when it changes either of day or of actor
detect_first_after_initial(potelet)
for story in potelet["history"]:
story["date"] = format_date(story["date"])
story["actor"] = format_actor(story["actor_type"], story["organisation"], story["department"])
return potelet
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment