2018-09-06 21:38:48 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Api
|
|
|
|
module V1
|
2018-10-07 01:53:31 +08:00
|
|
|
class TaskGroupsController < BaseController
|
2018-09-06 21:38:48 +08:00
|
|
|
before_action :load_team
|
|
|
|
before_action :load_project
|
|
|
|
before_action :load_experiment
|
2018-09-13 15:25:16 +08:00
|
|
|
before_action :load_task_group, only: :show
|
2018-09-06 21:38:48 +08:00
|
|
|
|
|
|
|
def index
|
2023-07-31 18:21:40 +08:00
|
|
|
task_groups = timestamps_filter(@experiment.my_module_groups).page(params.dig(:page, :number))
|
|
|
|
.per(params.dig(:page, :size))
|
2020-07-02 23:03:29 +08:00
|
|
|
render jsonapi: task_groups, each_serializer: TaskGroupSerializer, include: include_params
|
2018-09-06 21:38:48 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2018-10-07 16:16:00 +08:00
|
|
|
render jsonapi: @task_group,
|
2018-10-07 01:53:31 +08:00
|
|
|
serializer: TaskGroupSerializer,
|
|
|
|
include: :tasks
|
2018-09-06 21:38:48 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-09-13 15:25:16 +08:00
|
|
|
def load_task_group
|
2018-10-23 23:52:48 +08:00
|
|
|
@task_group = @experiment.my_module_groups.find(params.require(:id))
|
2018-09-06 21:38:48 +08:00
|
|
|
end
|
2020-07-02 23:03:29 +08:00
|
|
|
|
|
|
|
def permitted_includes
|
|
|
|
%w(tasks)
|
|
|
|
end
|
2018-09-06 21:38:48 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|