Beispiel #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
Beispiel #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
Beispiel #3
0
	def sync_projects(self):
		service     = self.config.service
		project_ids = []

		for p in self.service.get_projects():
			project = self.sync_project(p)
			project_ids.append(project.id)

		Project.delete().where( \
			(Project.service == service) & \
			~(Project.id << project_ids) #NOT IN \
		).execute()
Beispiel #4
0
    def sync_projects(self):
        service = self.config.service
        project_ids = []

        for p in self.service.get_projects():
            project = self.sync_project(p)
            project_ids.append(project.id)

        Project.delete().where( \
         (Project.service == service) & \
         ~(Project.id << project_ids) #NOT IN \
        ).execute()
Beispiel #5
0
    def sync_project(self, project_dict):
        service = self.config.service

        try:
            project = Project.select().where(
                Project.remote_id == project_dict['id'],
                Project.service == service).get()
            if project.title != project_dict['title']:
                project.title = project_dict['title']
                project.save()
        except Project.DoesNotExist:
            project = Project()
            project.remote_id = project_dict['id']
            project.title = project_dict['title']
            project.service = project_dict['service']
            project.save()

        return project
Beispiel #6
0
	def sync_project(self, project_dict):
		service = self.config.service

		try:
			project = Project.select().where(Project.remote_id == project_dict['id'], Project.service == service).get()
			if project.title != project_dict['title']:
				project.title = project_dict['title']
				project.save()
		except Project.DoesNotExist:
			project           = Project()
			project.remote_id = project_dict['id']
			project.title     = project_dict['title']
			project.service   = project_dict['service']
			project.save()

		return project