mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-14 19:37:51 +08:00
Fix report experiments sorting [SCI-5762]
This commit is contained in:
parent
90b02f9d4a
commit
24f4f6cbb2
3 changed files with 10 additions and 7 deletions
|
@ -1020,15 +1020,16 @@ function reportHandsonTableConverter() {
|
|||
});
|
||||
|
||||
// Project content
|
||||
reportData.project_content = { experiments: {}, repositories: [] };
|
||||
reportData.project_content = { experiments: [], tasks: {}, repositories: [] };
|
||||
$.each($('.project-contents-container .experiment-element'), function(i, experiment) {
|
||||
let expCheckbox = $(experiment).find('.report-experiment-checkbox');
|
||||
if (!expCheckbox.prop('checked') && !expCheckbox.prop('indeterminate')) return;
|
||||
|
||||
let experimentId = $(experiment).find('.report-experiment-checkbox').val();
|
||||
reportData.project_content.experiments[experimentId] = [];
|
||||
reportData.project_content.tasks[experimentId] = [];
|
||||
reportData.project_content.experiments.push(experimentId);
|
||||
$.each($(experiment).find('.report-my-module-checkbox:checked'), function(j, myModule) {
|
||||
reportData.project_content.experiments[experimentId].push(parseInt(myModule.value, 10));
|
||||
reportData.project_content.tasks[experimentId].push(parseInt(myModule.value, 10));
|
||||
});
|
||||
});
|
||||
$.each($('.task-contents-container .repositories-contents .sci-checkbox:checked'), function(i, e) {
|
||||
|
|
|
@ -105,11 +105,13 @@ class Report < ApplicationRecord
|
|||
def self.generate_whole_project_report(project, current_user, current_team)
|
||||
# report_contents = gen_element_content(project, Extends::EXPORT_ALL_PROJECT_ELEMENTS)
|
||||
content = {
|
||||
'experiments' => {},
|
||||
'experiments' => [],
|
||||
'tasks' => {},
|
||||
'repositories' => Repository.accessible_by_teams(project.team).pluck(:id)
|
||||
}
|
||||
project.experiments.includes(:my_modules).each do |experiment|
|
||||
content['experiments'][experiment.id] = experiment.my_modules.pluck(:id)
|
||||
content['experiments'].push(experiment.id)
|
||||
content['tasks'][experiment.id] = experiment.my_modules.pluck(:id)
|
||||
end
|
||||
|
||||
report = Report.new
|
||||
|
|
|
@ -51,8 +51,8 @@ module ReportActions
|
|||
private
|
||||
|
||||
def generate_content
|
||||
@content['experiments'].each do |exp_id, my_modules|
|
||||
generate_experiment_content(exp_id, my_modules)
|
||||
@content['experiments'].each do |exp_id|
|
||||
generate_experiment_content(exp_id, @content['tasks'][exp_id])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue