8cec62160ffd56f90c781f7524f643b95896c455,server/website/website/utils.py,TaskUtil,get_tasks,#Any#,75

Before Change


        if not tasks:
            return []
        task_ids = tasks.split(",")
        res = []
        for task_id in task_ids:
            task = TaskMeta.objects.filter(task_id=task_id)
            if len(task) == 0:
                continue  // Task Not Finished
            res.append(task[0])
        return res

    @staticmethod
    def get_task_status(tasks):

After Change


            task_ids = task_ids.split(",")
        preserved = Case(*[
            When(task_id=task_id, then=pos) for pos, task_id in enumerate(task_ids)])
        return TaskMeta.objects.filter(task_id__in=task_ids).order_by(preserved)

    @staticmethod
    def get_task_status(tasks):
        if not tasks:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: cmu-db/ottertune
Commit Name: 8cec62160ffd56f90c781f7524f643b95896c455
Time: 2020-01-08
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/utils.py
Class Name: TaskUtil
Method Name: get_tasks


Project Name: home-assistant/home-assistant
Commit Name: a2e45b8fdde315b756691b4ae573ad55f55dc002
Time: 2016-07-02
Author: rhooper@toybox.ca
File Name: homeassistant/components/history.py
Class Name:
Method Name: get_significant_states


Project Name: home-assistant/home-assistant
Commit Name: a2e45b8fdde315b756691b4ae573ad55f55dc002
Time: 2016-07-02
Author: rhooper@toybox.ca
File Name: homeassistant/components/history.py
Class Name:
Method Name: state_changes_during_period