message: Fix task unit progress creation
diff: @@ -7,6 +7,7 @@ import {ILecture} from '../../shared/models/ILecture';
  import {IUnit} from '../../shared/models/units/IUnit';
  import {IUser} from '../../shared/models/IUser';
  import {ITaskUnit} from '../../shared/models/units/ITaskUnit';
  +import {ITaskUnitModel} from '../src/models/units/TaskUnit';
  export class FixtureUtils {
  public static async getRandomUser(hash?: string) {
  @@ -190,17 +191,25 @@ export class FixtureUtils {
  return array;
  }
  - public static getAnswersFromTaskUnit(unit: ITaskUnit, success: boolean): any {
  + public static getAnswersFromTaskUnit(unit: ITaskUnitModel, success: boolean): any {
  const answers: any = {};
  - unit.tasks.forEach((task) => {
  + const unitObj: ITaskUnit = <ITaskUnit>unit.toObject();
  + unitObj.tasks.forEach((task) => {
  answers[task._id.toString()] = {};
  task.answers.forEach((answer) => {
  - let result = false;
  - if (success && answer.hasOwnProperty('value')) {
  - result = true;
  + if (success) {
  + if (answer.hasOwnProperty('value')) {
  + answers[task._id.toString()][answer._id.toString()] = true;
  + } else {
  + answers[task._id.toString()][answer._id.toString()] = false;
  + }
  + } else {
  + if (answer.hasOwnProperty('value')) {
  + answers[task._id.toString()][answer._id.toString()] = false;
  + } else {
  + answers[task._id.toString()][answer._id.toString()] = true;
  + }
  }
  -
  - answers[task._id.toString()][answer._id.toString()] = result;
  });
  });
  