mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-27 17:30:32 +08:00
Fix handling of snapshots of deleted repositories in reports [SCI-4698]
This commit is contained in:
parent
7a95355e81
commit
d774a82762
2 changed files with 5 additions and 3 deletions
|
@ -125,7 +125,9 @@ module ReportsHelper
|
|||
def assigned_repository_or_snapshot(my_module, element_id, snapshot, repository)
|
||||
if element_id
|
||||
repository = Repository.accessible_by_teams(my_module.experiment.project.team).find_by(id: element_id)
|
||||
repository ||= my_module.repository_snapshots.find_by(id: element_id)
|
||||
repository ||= RepositorySnapshot.joins(my_module: { experiment: :project })
|
||||
.where(my_module: { experiments: { project: my_module.experiment.project } })
|
||||
.find_by(id: element_id)
|
||||
end
|
||||
repository || snapshot
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<% repository = assigned_repository_or_snapshot(my_module, element_id, repository, repository_snapshot) %>
|
||||
<% order ||= @order %>
|
||||
<% timestamp = Time.current + 1.year - 1.days %>
|
||||
<% rows_json = repository.present? ? my_module.repository_json_hot(repository, order) : {} %>
|
||||
<% rows_json = my_module.repository_json_hot(repository, order) %>
|
||||
<div class="report-element report-module-repository-element"
|
||||
data-sort-hot="1"
|
||||
data-ts="<%= timestamp.to_i %>"
|
||||
|
@ -37,7 +37,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="report-element-body">
|
||||
<% if rows_json.present? && rows_json[:data].count > 0 %>
|
||||
<% if rows_json[:data].count > 0 %>
|
||||
<input type="hidden" class="hot-table-contents hot-samples" value='<%= rows_json.to_json.force_encoding(Encoding::UTF_8) %>' />
|
||||
<div class="hot-table-container"></div>
|
||||
<table class="report-common-table-format"></table>
|
||||
|
|
Loading…
Reference in a new issue