mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-09 21:56:32 +08:00
fixes notification [fixes SCI-337]
This commit is contained in:
parent
da735a51f4
commit
6c5cc8aac9
3 changed files with 18 additions and 14 deletions
|
|
@ -80,6 +80,9 @@ 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)
|
||||
|
|
|
|||
|
|
@ -82,20 +82,6 @@ class Experiment < ActiveRecord::Base
|
|||
.distinct
|
||||
end
|
||||
|
||||
def assigned_modules(user)
|
||||
role = self.project.user_role(user)
|
||||
if role.blank?
|
||||
return MyModule.none
|
||||
elsif role == "owner"
|
||||
return self.active_modules
|
||||
else
|
||||
return self.active_modules
|
||||
.joins(:user_my_modules)
|
||||
.where("user_my_modules.user_id IN (?)", user.id)
|
||||
.distinct
|
||||
end
|
||||
end
|
||||
|
||||
def active_modules
|
||||
my_modules.where(:archived => false)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -143,4 +143,19 @@ class Project < ActiveRecord::Base
|
|||
ids.delete_if { |i| i.flatten.empty? }
|
||||
ids.join(', ')
|
||||
end
|
||||
|
||||
def assigned_modules(user)
|
||||
role = user_role(user)
|
||||
if role.blank?
|
||||
MyModule.none
|
||||
elsif role == 'owner'
|
||||
project_my_modules.where(archived: false)
|
||||
else
|
||||
project_my_modules
|
||||
.joins(:user_my_modules)
|
||||
.where('user_my_modules.user_id IN (?)', user.id)
|
||||
.where(archived: false)
|
||||
.distinct
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue