示例#1
0
文件: projects.py 项目: shuhaowu/spm
def create_schedule_item(project_key, json):
  json.pop("key", None)
  json["starttime"] = datetime.strptime(json["starttime"], "%m/%d/%Y %H:%M")
  json["endtime"] = datetime.strptime(json["endtime"], "%m/%d/%Y %H:%M")
  schedule = Schedule(**json)
  schedule.addIndex("project_bin", project_key)
  schedule.save()
  return schedule
示例#2
0
文件: projects.py 项目: shuhaowu/spm
def get_schedules(project_key):
  schedules_queries = Schedule.indexLookup("project_bin", project_key)
  schedules = []
  for schedule in schedules_queries.run():
    schedules.append(schedule_to_json(schedule))

  schedules.sort(key=lambda x: x["starttime"])
  return schedules
示例#3
0
文件: projects.py 项目: shuhaowu/spm
def delete_schedule(schedule_key):
  Schedule.get(schedule_key).delete()