Exemple #1
0
    def sync_task(self, task_dict):
        project = None
        service = self.config.service

        try:
            task = Task.select().where(Task.remote_id == task_dict['id'],
                                       Task.service == service).get()

            if task.title != task_dict[
                    'title'] or task.remote_project_id != task_dict[
                        'project_id']:
                project = Project.select().where(
                    Project.remote_id == task_dict['project_id'],
                    Project.service == service).get()
                task.title = task_dict['title']
                task.remote_project_id = task_dict['project_id']
                task.project = project
                task.save()
        except Task.DoesNotExist:
            project = Project.select().where(
                Project.remote_id == task_dict['project_id0'],
                Project.service == service).get()

            task = Task()
            task.remote_id = task_dict['id']
            task.title = task_dict['title']
            task.service = task_dict['service']
            task.remote_project_id = task_dict['project_id']
            task.project = project
            task.save()

        return task
Exemple #2
0
	def sync_task(self, task_dict):
		project = None
		service = self.config.service

		try:
			task = Task.select().where(
				Task.remote_id == task_dict['id'],
				Task.service == service
			).get()

			if task.title != task_dict['title'] or task.remote_project_id != task_dict['project_id']:
				project                = Project.select().where(Project.remote_id == task_dict['project_id'], Project.service == service).get()
				task.title             = task_dict['title']
				task.remote_project_id = task_dict['project_id']
				task.project           = project
				task.save()
		except Task.DoesNotExist:
			project = Project.select().where(
				Project.remote_id == task_dict['project_id0'],
				Project.service == service
			).get()

			task                   = Task()
			task.remote_id         = task_dict['id']
			task.title             = task_dict['title']
			task.service           = task_dict['service']
			task.remote_project_id = task_dict['project_id']
			task.project           = project
			task.save()

		return task
Exemple #3
0
	def sync_tasks(self):
		service  = self.config.service
		task_ids = []

		for t in self.service.get_tasks():
			task = self.sync_task(t)
			task_ids.append(task.id)

		Task.delete().where( \
			(Task.service == service) & \
			~(Task.id << task_ids) #NOT IN \
		).execute()
Exemple #4
0
    def sync_tasks(self):
        service = self.config.service
        task_ids = []

        for t in self.service.get_tasks():
            task = self.sync_task(t)
            task_ids.append(task.id)

        Task.delete().where( \
         (Task.service == service) & \
         ~(Task.id << task_ids) #NOT IN \
        ).execute()