mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-07 21:55:20 +08:00
fixed experiments archive bug
This commit is contained in:
parent
b6ccecf478
commit
fa08b861d0
2 changed files with 6 additions and 6 deletions
|
@ -80,9 +80,6 @@ class ExperimentsController < ApplicationController
|
|||
@experiment.archived = true
|
||||
@experiment.archived_by = current_user
|
||||
@experiment.archived_on = DateTime.now
|
||||
@experiment.my_modules.each do |my_module|
|
||||
my_module.archive(current_user)
|
||||
end
|
||||
if @experiment.save
|
||||
flash[:success] = t('experiments.archive.success_flash',
|
||||
experiment: @experiment.name)
|
||||
|
|
|
@ -149,12 +149,15 @@ class Project < ActiveRecord::Base
|
|||
if role.blank?
|
||||
MyModule.none
|
||||
elsif role == 'owner'
|
||||
project_my_modules.where(archived: false)
|
||||
project_my_modules
|
||||
.joins(:experiment)
|
||||
.where('experiments.archived=false')
|
||||
else
|
||||
project_my_modules
|
||||
.joins(:user_my_modules)
|
||||
.where('user_my_modules.user_id IN (?)', user.id)
|
||||
.where(archived: false)
|
||||
.joins(:experiment)
|
||||
.where('experiments.archived=false AND user_my_modules.user_id IN (?)',
|
||||
user.id)
|
||||
.distinct
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue