<commit_before>import {
  getFirstStartDate,
  getLastEndDate,
  parseDate
} from '@/lib/time'
import moment from 'moment'

/*
 * Common functions to shot and asset pages.
 */
export const entityMixin = {

  created () {
  },

  mounted () {
  },

  beforeDestroy () {
  },

  computed: {
    currentTasks () {
      const entity = this.currentAsset || this.currentShot
      return entity
        ? entity
          .tasks
          .map(taskId => this.taskMap.get(taskId))
          .filter(task => task)
          .sort((a, b) => {
            const taskTypeA = this.taskTypeMap.get(a.task_type_id)
            const taskTypeB = this.taskTypeMap.get(b.task_type_id)
            return taskTypeA.priority > taskTypeB.priority
          })
        : []
    },

    tasksStartDate () {
      if (this.scheduleItems.length > 0) {
        return getFirstStartDate(this.scheduleItems[0].children)
      } else {
        return moment()
      }
    },

    tasksEndDate () {
      if (this.scheduleItems.length > 0) {
        return getLastEndDate(this.scheduleItems[0].children)
      } else {
        return moment().add(30, 'days')
      }
    },

    scheduleItems () {
      console.log(this.currentTasks)
      let manDays = 0
      const rootElement = {
        avatar: false,
        id: 'root',
        name: 'Tasks',
        color: '#888',
        for_shots: false,
        priority: 1,
        expanded: true,
        loading: false,
        children: [],
        editable: false
      }
      const limitStartDate = moment()
      const children = this.currentTasks.map(task => {
        const estimation = this.formatDuration(task.estimation)
        let startDate = limitStartDate.clone()
        let endDate

        if (!task.start_date && !task.real_start_date &&
            !task.due_date && !task.end_date) return null

        if (task.start_date) {
          startDate = parseDate(task.start_date)
        } else if (task.real_start_date) {
          startDate = parseDate(task.real_start_date)
        }

        if (task.due_date) {
          endDate = parseDate(task.due_date)
        } else if (task.end_date) {
          endDate = parseDate(task.end_date)
        } else if (task.estimation) {
          endDate = startDate.clone().add(estimation, 'days')
        }

        if (!endDate || endDate.isBefore(startDate)) {
          endDate = startDate.clone().add(1, 'days')
        }
        if (estimation) manDays += task.estimation
        const taskType = this.taskTypeMap.get(task.task_type_id)

        return {
          ...task,
          name: taskType.name,
          startDate: startDate,
          endDate: endDate,
          expanded: false,
          loading: false,
          man_days: estimation,
          editable: false,
          unresizable: false,
          parentElement: rootElement,
          color: taskType.color,
          children: []
        }
      }).filter(c => c !== null)
      const rootStartDate = getFirstStartDate(children)
      const rootEndDate = getLastEndDate(children)
      console.log(children)
      Object.assign(rootElement, {
        children: children,
        startDate: rootStartDate,
        endDate: rootEndDate,
        man_days: manDays
      })
      return [rootElement]
    }

  },

  methods: {
  }
}<commit_msg>[qa] Remove debug log<commit_after>import {
  getFirstStartDate,
  getLastEndDate,
  parseDate
} from '@/lib/time'
import moment from 'moment'

/*
 * Common functions to shot and asset pages.
 */
export const entityMixin = {

  created () {
  },

  mounted () {
  },

  beforeDestroy () {
  },

  computed: {
    currentTasks () {
      const entity = this.currentAsset || this.currentShot
      return entity
        ? entity
          .tasks
          .map(taskId => this.taskMap.get(taskId))
          .filter(task => task)
          .sort((a, b) => {
            const taskTypeA = this.taskTypeMap.get(a.task_type_id)
            const taskTypeB = this.taskTypeMap.get(b.task_type_id)
            return taskTypeA.priority > taskTypeB.priority
          })
        : []
    },

    tasksStartDate () {
      if (this.scheduleItems.length > 0) {
        return getFirstStartDate(this.scheduleItems[0].children)
      } else {
        return moment()
      }
    },

    tasksEndDate () {
      if (this.scheduleItems.length > 0) {
        return getLastEndDate(this.scheduleItems[0].children)
      } else {
        return moment().add(30, 'days')
      }
    },

    scheduleItems () {
      let manDays = 0
      const rootElement = {
        avatar: false,
        id: 'root',
        name: 'Tasks',
        color: '#888',
        for_shots: false,
        priority: 1,
        expanded: true,
        loading: false,
        children: [],
        editable: false
      }
      const limitStartDate = moment()
      const children = this.currentTasks.map(task => {
        const estimation = this.formatDuration(task.estimation)
        let startDate = limitStartDate.clone()
        let endDate

        if (!task.start_date && !task.real_start_date &&
            !task.due_date && !task.end_date) return null

        if (task.start_date) {
          startDate = parseDate(task.start_date)
        } else if (task.real_start_date) {
          startDate = parseDate(task.real_start_date)
        }

        if (task.due_date) {
          endDate = parseDate(task.due_date)
        } else if (task.end_date) {
          endDate = parseDate(task.end_date)
        } else if (task.estimation) {
          endDate = startDate.clone().add(estimation, 'days')
        }

        if (!endDate || endDate.isBefore(startDate)) {
          endDate = startDate.clone().add(1, 'days')
        }
        if (estimation) manDays += task.estimation
        const taskType = this.taskTypeMap.get(task.task_type_id)

        return {
          ...task,
          name: taskType.name,
          startDate: startDate,
          endDate: endDate,
          expanded: false,
          loading: false,
          man_days: estimation,
          editable: false,
          unresizable: false,
          parentElement: rootElement,
          color: taskType.color,
          children: []
        }
      }).filter(c => c !== null)
      const rootStartDate = getFirstStartDate(children)
      const rootEndDate = getLastEndDate(children)
      Object.assign(rootElement, {
        children: children,
        startDate: rootStartDate,
        endDate: rootEndDate,
        man_days: manDays
      })
      return [rootElement]
    }

  },

  methods: {
  }
}
{'fraction_non_alphanumeric': 0.11270836519345466, 'fraction_numerical': 0.003670285976448998, 'mean_word_length': 1.8925254312251216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5606326', 'n_tokens_mistral': 1977, 'n_tokens_neox': 1932, 'n_words': 393}