Skip to content

Commit

Permalink
feat: improve scenario name and description (#1240)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene authored Dec 23, 2024
1 parent 0833b9c commit 48ca9c0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
11 changes: 10 additions & 1 deletion backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,16 @@ def perform_create(self, serializer):
ref_id=operational_scenario.ref_id
if operational_scenario.ref_id
else RiskScenario.get_default_ref_id(instance),
description=operational_scenario.operating_modes_description,
description="\n\n".join(
filter(
None,
[
operational_scenario.attack_path.strategic_scenario.description.strip(),
operational_scenario.attack_path.description.strip(),
operational_scenario.operating_modes_description.strip(),
],
)
),
current_proba=operational_scenario.likelihood,
current_impact=operational_scenario.gravity,
)
Expand Down
6 changes: 5 additions & 1 deletion backend/ebios_rm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,11 @@ def ref_id(self):

@property
def name(self):
return self.attack_path.name
return (
self.attack_path.strategic_scenario.name[:95]
+ " - "
+ self.attack_path.name[:95]
)

@property
def gravity(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div>
<p class="text-sm font-semibold text-gray-400">{m.description()}</p>
{#if data.scenario.description}
<p>{data.scenario.description}</p>
<p class="whitespace-pre-line">{data.scenario.description}</p>
{:else}
<p class="text-gray-400 italic text-sm">{m.noDescription()}</p>
{/if}
Expand Down

0 comments on commit 48ca9c0

Please sign in to comment.