{"ScriptPreparationCode":"const statuses = {\r\n\tstatuses: {\r\n closedStatus: {\r\n id: 7,\r\n name: \u0027CLOSED\u0027,\r\n surname: \u0027\u0417\u0430\u043A\u0440\u044B\u0442\u043E\u0027\r\n },\r\n doneStatus: {\r\n id: 81,\r\n name: \u0027COMPLEATE\u0027\r\n },\r\n toDevelopersStatus: {\r\n id: 7129,\r\n name: \u0027TODEVELOPERS\u0027\r\n },\r\n intermediateStatus: {\r\n id: 3805,\r\n name: \u0027INTERMEDIATE\u0027\r\n },\r\n transferedStatus: {\r\n id: 1912,\r\n name: \u0022TRANSFERED\u0022\r\n },\r\n newStatus: {\r\n id: 5,\r\n name: \u0027NEW\u0027\r\n },\r\n toNpsStatus: {\r\n id: 7347,\r\n name: \u0027TONPS\u0027\r\n },\r\n informedStatus: {\r\n id: 80,\r\n name: \u0027INFORMED\u0027\r\n },\r\n inWorkStatus: {\r\n id: 6,\r\n name: \u0027INWORK\u0027\r\n }\r\n }\r\n };\r\n\r\nfunction getStatus(name) {\r\n return _.get(_.get(statuses, \u0027statuses\u0027), name);\r\n}\r\n\r\nfunction getStatusesBy(prop, ...statuses) {\r\n return statuses.reduce((prev, curr) =\u003E {\r\n return [\r\n ...prev,\r\n getStatus(curr)[prop] || getStatus(curr)\r\n ]\r\n }, [])\r\n }\r\n\r\nfunction getProhibitedStatuses() {\r\n return _.reduce([{ id: \u0027so\u0027 }], (accumulatorProhibitedStatuses, status) =\u003E {\r\n \r\n switch (status.id) {\r\n case \u0027so\u0027:\r\n return [ ...accumulatorProhibitedStatuses, \u0027toDevelopersStatus\u0027 ];\r\n default:\r\n return accumulatorProhibitedStatuses;\r\n }\r\n }, [\u0027closedStatus\u0027]);\r\n }\r\n \r\nfunction transformToInactiveStatuses(status) {\r\n status[\u0027inactive\u0027] = true;\r\n return status;\r\n}\r\n \r\nfunction getInactiveSelectionStatuses(statuses) {\r\n const arrayIssueStatusId = getStatusesBy(null, ...getProhibitedStatuses());\r\n\r\n const inactiveStatuses = _.map(arrayIssueStatusId, (id) =\u003E {\r\n return transformToInactiveStatuses(id);\r\n });\r\n\r\n return _.values(_.merge(_.keyBy(statuses, \u0027id\u0027), _.keyBy(inactiveStatuses, \u0027id\u0027)));\r\n }\r\n\r\nfunction getInactiveSelectionStatuses2(statuses) {\r\n const arrayIssueStatusId = getStatusesBy(null, ...getProhibitedStatuses());\r\n\r\n const inactiveStatuses = _.map(arrayIssueStatusId, (id) =\u003E {\r\n return transformToInactiveStatuses(id);\r\n });\r\n\r\n return _.map(statuses, (s =\u003E _.find(inactiveStatuses, (iS) =\u003E _.isEqual(s.id, iS.id)) || s));\r\n }\r\n \r\n","TestCases":[{"Name":"1","Code":"getInactiveSelectionStatuses([{id: 7, name: \u0027CLOSED\u0027}, {id: 7129,\r\n name: \u0027TODEVELOPERS\u0027}, {id: 5,\r\n name: \u0027NEW\u0027}])","IsDeferred":false},{"Name":"2","Code":"getInactiveSelectionStatuses2([{id: 7, name: \u0027CLOSED\u0027}, {id: 7129,\r\n name: \u0027TODEVELOPERS\u0027}, {id: 5,\r\n name: \u0027NEW\u0027}])","IsDeferred":false}]}