Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- metoda(){
- var questionID = -1;
- var answerID = -1;
- var questionBegin: Date;
- var answerBegin;
- this.lista = [];
- this.result.log.forEach(logEntry => {
- if(logEntry.type == "question"){
- if(questionID == -1 && logEntry.after != -1){
- questionID = logEntry.after;
- questionBegin = logEntry.time;
- return;
- }
- if(questionID != -1 && (logEntry.after != questionID || logEntry.after == -1)){
- this.lista.push({ content: logEntry.id, start: questionBegin, end: logEntry.time });
- questionID = logEntry.after;
- questionBegin = logEntry.time;
- }
- }
- if(logEntry.type == "answer"){
- if(answerID == -1 && logEntry.after != -1){
- answerID = logEntry.after;
- answerBegin = logEntry.time;
- return;
- }
- if(answerID != -1 && (logEntry.after != answerID || logEntry.after == -1)){
- this.lista.push({ content: logEntry.id, start: answerBegin, end: logEntry.time });
- answerID = logEntry.after;
- answerBegin = logEntry.time;
- }
- }
- });
- console.log(this.lista);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement