Пример #1
0
 def testing_start_date(self):
     result = "--"
     if self.fortesting.TestingStartDate:
         result = self.fortesting.TestingStartDate
     else:
         result = DateTimeHelper.get_now_date()
     return result
Пример #2
0
 def init_task(task_data, task, user_id):
     tmp_task = task
     for field in tmp_task.__dict__.keys():
         if field in task_data.keys():
             if field == 'id':
                 continue
             if field == 'DeadLine':
                 dead_line = task_data.get('DeadLine')
                 if dead_line == "":
                     tmp_task.DeadLine = DateTimeHelper.add_day(
                         DateTimeHelper.get_now_date(), 1)
                 else:
                     tmp_task.DeadLine = DateTimeHelper.get_date_StringFormat(
                         dead_line[0:10], '%Y-%m-%d')
                 continue
             if field == 'Owner':
                 owner = task_data.get('Owner')
                 if owner == "":
                     owner = str(user_id)
                 tmp_task.Owner = str(owner) + ','
                 continue
             if field == 'ProjectID':
                 project = task_data.get('ProjectID')[0]
                 version = task_data.get('ProjectID')[1]
                 print(project)
                 print(version)
                 tmp_task.ProjectID = project
                 tmp_task.Version = version
                 continue
             tmp_task.__setattr__(field, task_data.get(field))
     tmp_task.Progress = 0
     tmp_task.StartDate = None
     return tmp_task
Пример #3
0
    def init_task(task_data, task, user_id):
        tmp_task = task
        for field in tmp_task.__dict__.keys():
            if field in task_data.keys():
                if field == 'id':
                    continue
                if field == 'DeadLine':
                    dead_line = task_data.get('DeadLine')
                    if "000Z" in dead_line:
                        temp_date = datetime.datetime.strptime(
                            dead_line, "%Y-%m-%dT%H:%M:%S.000Z")
                        ts = int(temp_date.timestamp())
                        temp_date = datetime.datetime.fromtimestamp(
                            ts, pytz.timezone(TIME_ZONE))
                        offset = temp_date.tzinfo.utcoffset(temp_date)
                        temp_date = temp_date + datetime.timedelta(
                            seconds=offset.seconds)
                    else:
                        temp_date = dead_line

                    if dead_line == "":
                        tmp_task.DeadLine = DateTimeHelper.add_day(
                            DateTimeHelper.get_now_date(), 1)
                    else:
                        tmp_task.DeadLine = temp_date
                    continue
                if field == 'Owner':
                    continue
                if field == 'ProjectVersions':
                    continue

                if field == 'Progress':
                    tmp_task.Progress = float(task_data.get(field))
                tmp_task.__setattr__(field, task_data.get(field))
        return tmp_task
Пример #4
0
 def task_delayed_today(project_id, version_id, request):
     if str(project_id) == "0":
         project_all_tasks = TaskService.all_my_tasks(
             request, request.user.id)
     else:
         project_all_tasks = TaskService.project_all_tasks(0, project_id)
     project_all_tasks = project_all_tasks.exclude(Status=2).filter(
         Parent__isnull=True)
     if str(version_id) != "0":
         project_all_tasks = project_all_tasks.filter(
             Version=int(version_id))
     return project_all_tasks.filter(
         DeadLine__lt=DateTimeHelper.get_now_date()).count()
Пример #5
0
    def task_finished_today(project_id, version_id, request):
        if str(project_id) == "0":
            project_all_tasks = TaskService.all_my_tasks(
                request, request.user.id)
        else:
            project_all_tasks = TaskService.project_all_tasks(0, project_id)

        if str(version_id) != "0":
            project_all_tasks = project_all_tasks.filter(
                Version=int(version_id))
        project_all_tasks = project_all_tasks.filter(Parent__isnull=True)
        return project_all_tasks.filter(
            FinishedDate=DateTimeHelper.get_now_date()).count()