예제 #1
0
 def delete_worksheet(self, worksheet_id, modifier_id):
     worksheet = Worksheet.get_by_key(worksheet_id)
     worksheet.delete(modifier_id)
     query = Task.all()
     query.filter("worksheet_id =", worksheet_id)
     query.set("worksheet_id", EMPTY_UID)
     query.set("is_trashed", True)
     query.update(modifier_id)
     query = Worksheet.all()
     return True
예제 #2
0
 def create_worksheet(self, worksheet, modifier_id):
     query = Worksheet.all()
     query.order("-ws_order")
     if query.count() > 0:
         worksheet.ws_order = query.get().ws_order + 1
     else:
         worksheet.ws_order = 1
     worksheet.put(modifier_id)
     return worksheet
예제 #3
0
 def fetch_worksheets(self, user_id, sharetome=None, withtaskcount=True):
     query = Worksheet.all(alias="a")
     if sharetome:
         group_ids = ContactService.get_instance().fetch_my_groups(user_id, onlyrtnids=True, include_self=False)
         if len(group_ids) > 0:
             query.filter("group_id in", group_ids)
         else:
             return []
     else:
         query.filter("creator_id =", user_id)
     
     query.order("ws_order")
     def worksheet_proc(worksheet):
         if withtaskcount:
             worksheet.taskcount = self.get_taskcount(False, user_id, worksheet_id=worksheet.uid)
     
     worksheets = query.fetch(model_proc=worksheet_proc)
     return worksheets
예제 #4
0
 def get_worksheet(self, worksheet_id):
     worksheet = Worksheet.get_by_key(worksheet_id)
     return worksheet