Skip to content

Commit

Permalink
Decrease nesting in the code
Browse files Browse the repository at this point in the history
Cherry picked from @mauritsvanrees PR
#715
  • Loading branch information
ale-rt committed Apr 19, 2024
1 parent af3e98f commit 11d3623
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/euphorie/client/browser/risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,19 +603,20 @@ def set_answer_data(self, reply):
# If answer is not present in the request, do not attempt to set
# any answer-related data, since the request might have come
# from a sub-form.
if answer:
self.context.comment = self.webhelpers.get_safe_html(reply.get("comment"))
self.context.postponed = answer == "postponed"
if self.context.postponed:
self.context.identification = None
else:
self.context.identification = answer
if getattr(self.risk, "type", "") in ("top5", "policy"):
self.context.priority = "high"
elif getattr(self.risk, "evaluation_method", "") == "calculated":
self.calculatePriority(self.risk, reply)
elif self.risk is None or self.risk.evaluation_method == "direct":
self.context.priority = reply.get("priority")
if not answer:
return
self.context.comment = self.webhelpers.get_safe_html(reply.get("comment"))
self.context.postponed = answer == "postponed"
if self.context.postponed:
self.context.identification = None
return
self.context.identification = answer
if getattr(self.risk, "type", "") in ("top5", "policy"):
self.context.priority = "high"
elif getattr(self.risk, "evaluation_method", "") == "calculated":
self.calculatePriority(self.risk, reply)
elif self.risk is None or self.risk.evaluation_method == "direct":
self.context.priority = reply.get("priority")

def set_measure_data(self, reply, session):
changed = False
Expand Down

0 comments on commit 11d3623

Please sign in to comment.