Skip to content

Commit

Permalink
Update CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-aranda committed Nov 6, 2023
1 parent 4d966a1 commit 22dd919
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Version History
v5.14.9
-------

* Remove JIRA fields ids mapping `<https://github.com/lsst-ts/LOVE-manager/pull/221>`_
* Bump urllib3 from 1.26.17 to 1.26.18 in /manager `<https://github.com/lsst-ts/LOVE-manager/pull/218>`_

v5.14.8
Expand Down
45 changes: 31 additions & 14 deletions manager/api/tests/test_jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,39 @@ def setUp(self):

request_narrative = {
"components": ",".join(
OLE_JIRA_OBS_COMPONENTS_FIELDS[
: math.ceil(random.random() * len(OLE_JIRA_OBS_COMPONENTS_FIELDS))
list(
OLE_JIRA_OBS_COMPONENTS_FIELDS[
: math.ceil(
random.random() * (len(OLE_JIRA_OBS_COMPONENTS_FIELDS) - 1)
)
]
)
),
"components_ids": ",".join(
[str(n) for n in range(1, math.ceil(random.random() * 100))]
),
"primary_software_components": ",".join(
OLE_JIRA_OBS_PRIMARY_SOFTWARE_COMPONENT_FIELDS[
math.ceil(
random.random()
* (len(OLE_JIRA_OBS_PRIMARY_SOFTWARE_COMPONENT_FIELDS) - 1)
)
]
),
"primary_software_components": OLE_JIRA_OBS_PRIMARY_SOFTWARE_COMPONENT_FIELDS[
math.ceil(
random.random()
* len(OLE_JIRA_OBS_PRIMARY_SOFTWARE_COMPONENT_FIELDS)
)
],
"primary_hardware_components": OLE_JIRA_OBS_PRIMARY_HARDWARE_COMPONENT_FIELDS[
math.ceil(
random.random()
* len(OLE_JIRA_OBS_PRIMARY_HARDWARE_COMPONENT_FIELDS)
)
],
"primary_software_components_ids": ",".join(
[str(math.ceil(random.random() * 100))]
),
"primary_hardware_components": ",".join(
OLE_JIRA_OBS_PRIMARY_HARDWARE_COMPONENT_FIELDS[
math.ceil(
random.random()
* (len(OLE_JIRA_OBS_PRIMARY_HARDWARE_COMPONENT_FIELDS) - 1)
)
]
),
"primary_hardware_components_ids": ",".join(
[str(math.ceil(random.random() * 100))]
),
"date_begin": "2022-07-03T19:58:13.00000",
"date_end": "2022-07-04T19:25:13.00000",
"time_lost": 10,
Expand Down
20 changes: 15 additions & 5 deletions manager/manager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ def jira_ticket(request_data):
return Response({"ack": "Error reading request type"}, status=400)

tags_data = request_data.get("tags").split(",") if request_data.get("tags") else []

components_ids = (
request_data.get("components_ids").split(",")
if request_data.get("components_ids")
Expand All @@ -403,17 +404,18 @@ def jira_ticket(request_data):
primary_software_components_ids = (
request_data.get("primary_software_components_ids").split(",")
if request_data.get("primary_software_components_ids")
else []
else None
)
primary_hardware_components_ids = (
request_data.get("primary_hardware_components_ids").split(",")
if request_data.get("primary_hardware_components_ids")
else []
else None
)

try:
jira_payload = {
"fields": {
"issuetype": {"id": 12302},
"project": {"id": os.environ.get("JIRA_PROJECT_ID")},
"labels": [
"LOVE",
Expand All @@ -425,9 +427,17 @@ def jira_ticket(request_data):
if int(request_data.get("level", 0)) >= 100
else "off",
"customfield_16702": float(request_data.get("time_lost", 0)),
"customfield_17204": {"id": str(primary_software_components_ids[0])},
"customfield_17205": {"id": str(primary_hardware_components_ids[0])},
"issuetype": {"id": 12302},
# Default values of the following fields are set to -1
"customfield_17204": {
"id": str(primary_software_components_ids[0])
if primary_software_components_ids
else "-1"
},
"customfield_17205": {
"id": str(primary_hardware_components_ids[0])
if primary_hardware_components_ids
else "-1"
},
},
"update": {
"components": [{"set": [{"id": str(id)} for id in components_ids]}]
Expand Down

0 comments on commit 22dd919

Please sign in to comment.