el.status = ("Статус") in el.changelog ? el.changelog["Статус"].after : 'не назначен';
const initialState = [];
const changed = ' изменён статус запроса на';
var log = [];
var comments = [];
export function queryLog(state = initialState, action): object {
if (action.type === constants.LOAD_QUERY_LOG_STOP) {
log = action.queryLog;
}
if (action.type === constants.LOAD_COMMENTS_STOP) {
comments = action.comments;
}
let summ = log.concat(comments).map(el => {
el.date = el.dt_changelog * 1000 || el.datetime * 1000;
el.type = el.dt_changelog ? 'changelog' : 'comment';
el.text = el.dt_changelog ? changed : el.text;
el.author = el.dt_changelog ? el.usr.source : el.author;
el.status = ("Статус") in el.changelog ? el.changelog["Статус"].after : 'не назначен';
return el;
});
console.log('!!!!!!!!!!!!!!!!!!!!!');
console.log(comments);
console.log(log);
console.log(summ);
summ.sort(function(a, b) {
if (a.date > b.date) {
return 1;
}
if (a.date < b.date) {
return -1;
}
return 0;
});
return summ;
}
el.forEach(item=>{
item.status = "Статус" in item.changelog ? item.changelog["Статус"].after : "не назначен";
});
// ...
let summ = log.concat(comments).map(items => {
items.forEach(el=>{
el.date = el.dt_changelog * 1000 || el.datetime * 1000;
el.type = el.dt_changelog ? 'changelog' : 'comment';
el.text = el.dt_changelog ? changed : el.text;
el.author = el.dt_changelog ? el.usr.source : el.author;
el.status = ("Статус") in el.changelog ? el.changelog["Статус"].after : 'не назначен';
});
return items;
});
// ...
console.log(el);
// ...
let summ = log.concat(comments).map(items => {
items.forEach(el=>{
el.date = el.dt_changelog * 1000 || el.datetime * 1000;
el.type = el.dt_changelog ? 'changelog' : 'comment';
el.text = el.dt_changelog ? changed : el.text;
el.author = el.dt_changelog ? el.usr.source : el.author;
el.status = ("Статус") in el.changelog ? el.changelog["Статус"].after : 'не назначен';
});
return items;
});
// ...
export function queryLog(state = initialState, action): object {
if (action.type === constants.LOAD_QUERY_LOG_STOP) {
log = action.queryLog;
}
if (action.type === constants.LOAD_COMMENTS_STOP) {
comments = action.comments;
}
const list = log.concat(comments);
console.log("list:", list); // ----------- 1 ----------------
let summ = list.map(el => {
console.log("el:", el); // ----------- 2 ----------------
el.date = el.dt_changelog * 1000 || el.datetime * 1000;
el.type = el.dt_changelog ? 'changelog' : 'comment';
el.text = el.dt_changelog ? changed : el.text;
el.author = el.dt_changelog ? el.usr.source : el.author;
el.status = ("Статус") in el.changelog ? el.changelog["Статус"].after : 'не назначен';
return el;
});
console.log('!!!!!!!!!!!!!!!!!!!!!');
console.log(comments);
console.log(log);
console.log(summ);
summ.sort(function(a, b) {
if (a.date > b.date) {
return 1;
}
if (a.date < b.date) {
return -1;
}
return 0;
});
return summ;
}
el.status = ("Статус") in el.changelog ? el.changelog["Статус"].after : 'не назначен';
el.status = el.changelog ? ("Статус") in el.changelog ? el.changelog["Статус"].after : 'не назначен' : 'нет лога изменений';
TypeError: Cannot use `in` operator to search for `Статус` for undefined
вы не можете использовать оператор in для поиска "Статус" если переменная в которой производится поиск НЕОПРЕДЕЛЕНА
("Статус") in el.changelog
)el.changelog
надо проверить, существует ли он:el.status = el.changelog ? ("Статус") in el.changelog ? el.changelog["Статус"].after : 'не назначен' : 'нет лога изменений';