Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short report tweaks #648

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog
-------------------

- Updated translations
- Short report tweaks
Ref: scrum-1295
[reinhardt]


15.0.5 (2023-09-27)
Expand Down
60 changes: 41 additions & 19 deletions src/euphorie/client/docx/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,13 @@ def set_session_title_row(self, data):
# left we have a logo, center for text, right for the page numbers
cell1, cell2, cell3 = footer.tables[0].row_cells(0)
cell2.paragraphs[0].text = "{}".format(date.today().strftime("%d.%m.%Y"))
inner = cell3.tables[0].cell(0, 1)
inner.paragraphs[0].runs[6].text = api.portal.translate(
_(
"label_page_of",
default="of",
),
)

def set_cell_risk(self, cell, risk):
"""Take the risk and add the appropriate text:
Expand All @@ -659,29 +666,32 @@ def set_cell_risk(self, cell, risk):

cell.add_paragraph(style="Risk Normal")

def set_cell_risk_priority(self, cell, risk):
priority = risk.get("priority", "high")
if priority:
if priority == "low":
level = _("risk_priority_low", default="low")
elif priority == "medium":
level = _("risk_priority_medium", default="medium")
elif priority == "high":
level = _("risk_priority_high", default="high")
paragraph = cell.add_paragraph(
"{}: {}".format(
api.portal.translate(
_("report_timeline_priority", default="Priority")
),
api.portal.translate(level),
),
style="Measure Indent",
)
paragraph.runs[0].italic = True

def set_cell_risk_title(self, cell, risk):
paragraph = cell.paragraphs[0]
paragraph.style = "Risk Bold List"
paragraph.text = risk["title"]
if self.show_priority:
priority = risk.get("priority", "high")
if priority:
if priority == "low":
level = _("risk_priority_low", default="low")
elif priority == "medium":
level = _("risk_priority_medium", default="medium")
elif priority == "high":
level = _("risk_priority_high", default="high")
paragraph = cell.add_paragraph(
"{}: {}".format(
api.portal.translate(
_("report_timeline_priority", default="Priority")
),
api.portal.translate(level),
),
style="Measure Indent",
)
paragraph.runs[0].italic = True
self.set_cell_risk_priority(cell, risk)

def set_cell_risk_comment(self, cell, risk):
if risk["comment"] and risk["comment"].strip():
Expand Down Expand Up @@ -997,7 +1007,15 @@ def compile(self, data):
class DocxCompilerShort(DocxCompilerFullTable):
_base_filename = "oira_short.docx"

justifiable_map = {"yes": "✅", "no": "❌"}
justifiable_map = {"yes": "✅", "no": "❌", None: "⧁"}

def set_cell_risk_title(self, cell, risk):
paragraph = cell.paragraphs[0]
paragraph.style = "Risk Bold List"
paragraph.text = " ".join((risk["number"], risk["title"]))
paragraph.paragraph_format.left_indent = 0
if self.show_priority:
self.set_cell_risk_priority(cell, risk)

def set_cell_risk(self, cell, risk):
"""Take the risk and add the appropriate text:
Expand Down Expand Up @@ -1052,6 +1070,10 @@ def set_cell_action_responsible(self, cell, action):
)
text_responsible = " – ".join((text_responsible, text_date))
if text_responsible:
cell.add_paragraph(
"",
style="Measure Indent",
)
paragraph = cell.add_paragraph(
text_responsible,
style="Measure Indent",
Expand Down
Loading