Skip to content

Commit

Permalink
Further fixes on jira payload readings
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-aranda committed Jan 25, 2023
1 parent a39b3d5 commit c49f977
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
13 changes: 4 additions & 9 deletions manager/api/tests/test_jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@ def setUp(self):
"user_agent",
"tags",
]
exposure_params = ["obs_id", "instrument", "exposure_flag"]
narrative_params = [
"systems",
"subsystems",
"cscs",
exposure_params_required = ["obs_id", "instrument", "exposure_flag"]
narrative_params_required = [
"date_begin",
"date_end",
"time_lost",
"level",
]

request_shared = {
Expand Down Expand Up @@ -92,7 +87,7 @@ def setUp(self):
)

data_exposure_without_param = {**request_full_exposure}
del data_exposure_without_param[random.choice(exposure_params)]
del data_exposure_without_param[random.choice(exposure_params_required)]
self.jira_request_exposure_without_param = requests.Request(
data=data_exposure_without_param
)
Expand All @@ -111,7 +106,7 @@ def setUp(self):
)

data_narrative_without_param = {**request_full_narrative}
del data_narrative_without_param[random.choice(narrative_params)]
del data_narrative_without_param[random.choice(narrative_params_required)]
self.jira_request_narrative_without_param = requests.Request(
data=data_narrative_without_param
)
Expand Down
18 changes: 15 additions & 3 deletions manager/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,9 +1194,21 @@ def makeJiraDescription(request_data):
# Narrative log params
if request_type == "narrative":
try:
systems = ", ".join(request_data["systems"].split(","))
subsystems = ", ".join(request_data["subsystems"].split(","))
cscs = ", ".join(request_data["cscs"].split(","))
systems = (
", ".join(request_data["systems"].split(","))
if request_data.get("systems", False)
else "None"
)
subsystems = (
", ".join(request_data["subsystems"].split(","))
if request_data.get("subsystems", False)
else "None"
)
cscs = (
", ".join(request_data["cscs"].split(","))
if request_data.get("cscs", False)
else "None"
)
begin_date = request_data["date_begin"]
end_date = request_data["date_end"]
time_lost = str(request_data["time_lost"])
Expand Down

0 comments on commit c49f977

Please sign in to comment.