mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
Review changes
This commit is contained in:
parent
ae3c19ced5
commit
1159ce519c
3 changed files with 13 additions and 5 deletions
|
@ -6,7 +6,7 @@ module Api
|
||||||
before_action :load_team
|
before_action :load_team
|
||||||
before_action :load_project
|
before_action :load_project
|
||||||
before_action :load_experiment
|
before_action :load_experiment
|
||||||
before_action :load_task_groups, only: :show
|
before_action :load_task_group, only: :show
|
||||||
|
|
||||||
def index
|
def index
|
||||||
my_module_groups = @experiment.my_module_groups
|
my_module_groups = @experiment.my_module_groups
|
||||||
|
@ -42,11 +42,10 @@ module Api
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_task_groups
|
def load_task_group
|
||||||
@my_module_group = @experiment.my_module_groups.find(
|
@my_module_group = @experiment.my_module_groups.find(
|
||||||
params.require(:id)
|
params.require(:id)
|
||||||
)
|
)
|
||||||
render jsonapi: {}, status: :not_found if @my_module_group.nil?
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,15 @@ module Api
|
||||||
class ConnectionSerializer < ActiveModel::Serializer
|
class ConnectionSerializer < ActiveModel::Serializer
|
||||||
type :connections
|
type :connections
|
||||||
attributes :id, :input_id, :output_id
|
attributes :id, :input_id, :output_id
|
||||||
|
has_one :input_task, serializer: MyModuleSerializer
|
||||||
|
has_one :output_task, serializer: MyModuleSerializer
|
||||||
|
def input_task
|
||||||
|
MyModule.find(object.input_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def output_task
|
||||||
|
MyModule.find(object.output_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,8 +4,8 @@ module Api
|
||||||
module V1
|
module V1
|
||||||
class MyModuleSerializer < ActiveModel::Serializer
|
class MyModuleSerializer < ActiveModel::Serializer
|
||||||
type :tasks
|
type :tasks
|
||||||
attributes :id, :name, :due_date, :description,
|
attributes :id, :name, :due_date, :description, :state
|
||||||
:my_module_group_id, :nr_of_assigned_samples, :state
|
attribute :my_module_group_id, key: :task_group_id
|
||||||
belongs_to :experiment, serializer: ExperimentSerializer
|
belongs_to :experiment, serializer: ExperimentSerializer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue