我需要从HTTP响应中找到Open
,In Progress
,Resolved
和Closed
的计数。
响应的预期输出
Open = 1;
In Progress = 1;
Resolved = 1;
Closed = 1
下面是我的功能
getJiraOpenIssues(id:string, status:string) {
return this.http.get<any>( apiUrl + this.auth)
.subscribe(count => console.log(count));
}
HTTP响应
{
"expand": "schema,names",
"startAt": 0,
"maxResults": 100,
"total": 184,
"issues": [
{
"status": {
"name": "Open"
}
},
{
"status": {
"name": "In Progress"
}
},
{
"status": {
"name": "Resolved"
}
},
{
"status": {
"name": "Closed"
}
}
]
}
更新
getJiraOpenIssues(id:string, status:string) {
return this.http.get<any>( apiUrl + this.auth)
.subscribe(response => {
let a = new Map(...new Set<any>(response).map(
x => [x, this.response.issue.filter(y => y === x).length]
));
});
}
使用上述功能,我会收到此错误
[ts]类型“设置”上不存在属性“地图”。