mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 01:03:18 +08:00
Update scopes in reports
This commit is contained in:
parent
83bd8c3ad4
commit
123375f494
5 changed files with 10 additions and 12 deletions
|
@ -115,7 +115,7 @@ class MyModuleRepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def load_repository
|
||||
@repository = Repository.find_by(id: params[:id])
|
||||
@repository = Repository.with_archived.find_by(id: params[:id])
|
||||
render_404 unless @repository
|
||||
end
|
||||
|
||||
|
|
|
@ -351,11 +351,7 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
def load_repositories
|
||||
@repositories = Repository.accessible_by_teams(current_team).order('repositories.created_at ASC')
|
||||
@repositories = if params[:archived]
|
||||
@repositories.archived
|
||||
else
|
||||
@repositories
|
||||
end
|
||||
@repositories = @repositories.archived if params[:archived]
|
||||
end
|
||||
|
||||
def set_inline_name_editing
|
||||
|
|
|
@ -123,7 +123,7 @@ module ReportsHelper
|
|||
end
|
||||
|
||||
def assign_repository_or_snapshot(my_module, element_id, snapshot, repository)
|
||||
original_repository = Repository.find_by(id: element_id) if element_id
|
||||
original_repository = Repository.with_archived.find_by(id: element_id) if element_id
|
||||
repository ||= snapshot
|
||||
repository || my_module.active_snapshot_or_live(original_repository) || original_repository
|
||||
end
|
||||
|
|
|
@ -5,10 +5,12 @@ class RepositorySnapshot < RepositoryBase
|
|||
after_save :refresh_report_references, if: :saved_change_to_selected
|
||||
before_destroy :refresh_report_references_for_destroy, prepend: true
|
||||
|
||||
belongs_to :original_repository, foreign_key: :parent_id,
|
||||
belongs_to :original_repository, -> { unscope(where: :archived) },
|
||||
foreign_key: :parent_id,
|
||||
class_name: 'Repository',
|
||||
inverse_of: :repository_snapshots,
|
||||
optional: true
|
||||
|
||||
belongs_to :my_module, optional: true
|
||||
|
||||
validates :name, presence: true, length: { maximum: Constants::NAME_MAX_LENGTH }
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<%= form.check_box :module_activity, label: t("projects.reports.elements.modals.module_contents_inner.activity") %>
|
||||
</li>
|
||||
<% # List all repositories, no matter whether rows are assigned or not %>
|
||||
<% Repository.accessible_by_teams(@project.team).order(created_at: :asc).select(:id, :name).find_each do |repository| %>
|
||||
<% Repository.accessible_by_teams(@project.team).with_archived.order(created_at: :asc).select(:id, :name).find_each do |repository| %>
|
||||
<li>
|
||||
<%= form.check_box "module_repository_#{repository.id}", label: repository.name.capitalize, data: { id: repository.id } %>
|
||||
</li>
|
||||
|
|
Loading…
Reference in a new issue