mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-18 17:56:00 +08:00
Adding of experiment content now works in reports
This commit is contained in:
parent
5854e72878
commit
aedaf2f30a
1 changed files with 15 additions and 1 deletions
|
@ -321,8 +321,22 @@ class ReportsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def experiment_contents
|
def experiment_contents
|
||||||
|
experiment = Experiment.find_by_id(params[:id])
|
||||||
|
if params.include? :modules then
|
||||||
|
modules =
|
||||||
|
(params[:modules].select { |m, p| p == "1" })
|
||||||
|
.keys
|
||||||
|
.collect { |id| id.to_i }
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
elements = generate_experiment_contents_json
|
if experiment.blank?
|
||||||
|
format.json { render json: {}, status: :not_found }
|
||||||
|
elsif modules.blank?
|
||||||
|
format.json { render json: {}, status: :no_content }
|
||||||
|
else
|
||||||
|
elements = generate_experiment_contents_json(experiment, modules)
|
||||||
|
end
|
||||||
|
|
||||||
if elements_empty? elements
|
if elements_empty? elements
|
||||||
format.json { render json: {}, status: :no_content }
|
format.json { render json: {}, status: :no_content }
|
||||||
|
|
Loading…
Add table
Reference in a new issue