static fetchRelatedTasks()

in resources/perf.webkit.org/public/v3/models/analysis-task.js [243:268]


    static fetchRelatedTasks(taskId)
    {
        // FIXME: We should add new sever-side API to just fetch the related tasks.
        return this.fetchAll().then(function () {
            var task = AnalysisTask.findById(taskId);
            if (!task)
                return undefined;
            var relatedTasks = new Set;
            for (var bug of task.bugs()) {
                for (var otherTask of AnalysisTask.all()) {
                    if (otherTask.bugs().includes(bug))
                        relatedTasks.add(otherTask);
                }
            }
            for (var otherTask of AnalysisTask.all()) {
                if (task.isCustom())
                    continue;
                if (task.endTime() < otherTask.startTime()
                    || otherTask.endTime() < task.startTime()
                    || task.metric() != otherTask.metric())
                    continue;
                relatedTasks.add(otherTask);
            }
            return Array.from(relatedTasks);
        });
    }