<commit_before>const { getTeams, getTeamProjects, getProjectTasks } = require('../lib/api');
const { model: { User, Team, Project, Task, Label, TaskLabels } } = require('../model');
const { defaults: { type } } = require('../config');
const redis = require('../lib/redis');

// eslint-disable-next-line camelcase
const updateLabels = (task_id, labels) => {
  labels.forEach(async (label) => {
    await Label.upsert(label);
    await TaskLabels.upsert({ task_id, label_id: label.id });
  });
  return true;
};

const updateTasks = (tasks) => {
  tasks.forEach(async (task) => {
    updateLabels(task.id, task.labels);
    /* eslint-disable no-param-reassign */
    delete task.labels;
    const owner = task.owner;
    await User.upsert(owner);
    delete task.owner;
    let deadline = 0;
    if (task.deadline) {
      deadline = new Date(`${new Date(task.deadline).toLocaleDateString()} 22:00:00`).getTime();
    }
    await Task.upsert(Object.assign(task, { owner_id: owner.id, deadline }));
  });
  return true;
};

const updateProjects = (projects, team = '') => {
  projects.forEach(async (project) => {
    await Project.upsert(project);
    const tasks = await getProjectTasks({ team, project: project.name });
    updateTasks(tasks.list);
  });<commit_msg>fix date padding<commit_after>const { getTeams, getTeamProjects, getProjectTasks } = require('../lib/api');
const { model: { User, Team, Project, Task, Label, TaskLabels } } = require('../model');
const { defaults: { type } } = require('../config');
const redis = require('../lib/redis');

// eslint-disable-next-line camelcase
const updateLabels = (task_id, labels) => {
  labels.forEach(async (label) => {
    await Label.upsert(label);
    await TaskLabels.upsert({ task_id, label_id: label.id });
  });
  return true;
};

const updateTasks = (tasks) => {
  tasks.forEach(async (task) => {
    updateLabels(task.id, task.labels);
    /* eslint-disable no-param-reassign */
    delete task.labels;
    const owner = task.owner;
    await User.upsert(owner);
    delete task.owner;
    let deadline = 0;
    if (task.deadline) {
      deadline = new Date(`${new Date(task.deadline).toLocaleDateString()} 12:00:00`).getTime();
    }
    await Task.upsert(Object.assign(task, { owner_id: owner.id, deadline }));
  });
  return true;
};

const updateProjects = (projects, team = '') => {
  projects.forEach(async (project) => {
    await Project.upsert(project);
    const tasks = await getProjectTasks({ team, project: project.name });
    updateTasks(tasks.list);
  });
{'fraction_non_alphanumeric': 0.17199211045364893, 'fraction_numerical': 0.005522682445759369, 'mean_word_length': 3.7050092764378477, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '3350903', 'n_tokens_mistral': 817, 'n_tokens_neox': 820, 'n_words': 180}