def get_query_info(submitionid): query_info = list() testjobs = DAL_TestJob.getjobsbysubmitionid(submitionid) today = str(datetime.date.today()) if len(testjobs): testjob = testjobs[0] query_info.append(testjob.TJStartTime) if testjob.TJFinishedTime: tempDate = str( DateTimeHelper.add_day(str(testjob.TJFinishedTime), 1))[0:10] query_info.append(tempDate) elif int(testjob.TJProgress) == 100: tempDate = str( DateTimeHelper.add_day(str(testjob.TJEndTime), 1))[0:10] query_info.append(tempDate) else: query_info.append(str(datetime.date.today())) query_info[1] = str(DateTimeHelper.add_day(query_info[1], 1))[0:10] else: query_info.append(str(datetime.date.today())) query_info.append(str(DateTimeHelper.add_day(today, 1))[0:10]) testsubmition = DAL_TestSubmition.gettestsubmition(submitionid) bugfree_mapping_item = DAL_BugReport.get_bugfree_module( testsubmition.TPSProductName, testsubmition.TPSPlatform) query_info.append(bugfree_mapping_item.BugfreeProjectID) return query_info
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
def get_ReleaseDate(self, obj): result = "" if obj.TestingDeadLineDate: result = str( DateTimeHelper.add_day(str(obj.TestingDeadLineDate)[:10], 1))[0:10] return result
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