Skip to content

Commit

Permalink
Adds content to blank reporting page
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-bernhardt committed Oct 1, 2021
1 parent ac0de4d commit d6019c6
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/report_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def files
theses = Thesis.all
@terms = report.extract_terms theses
subset = filter_theses_by_term theses
@list = report.list_unattached_files subset
end

def index
Expand Down
10 changes: 10 additions & 0 deletions app/models/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ def extract_terms(collection)
collection.pluck(:grad_date).uniq.sort
end

def list_unattached_files(collection)
result = []
collection.joins(:files_attachments).order(:grad_date).uniq.each do |record|
record.files.where(purpose: nil).each do |file|
result.push(file)
end
end
result
end

def table_copyright(collection)
result = {}
collection.group(:copyright).count.each do |record|
Expand Down
3 changes: 3 additions & 0 deletions app/views/report/_files_empty.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<tr>
<td colspan="4">There are no files without an assigned purpose within the selected term.</td>
</tr>
14 changes: 14 additions & 0 deletions app/views/report/_files_without_purpose.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<tr>
<td><%= link_to(files_without_purpose.blob[:filename],thesis_process_path(files_without_purpose[:record_id])) %></td>
<td>
<% files_without_purpose.record.authors.each do |author| %>
<%= author.user.display_name %><br>
<% end %>
</td>
<td>
<% files_without_purpose.record.departments.each do |dept| %>
<%= dept.name_dw %><br>
<% end %>
</td>
<td><%= files_without_purpose[:description] %></td>
</tr>
15 changes: 15 additions & 0 deletions app/views/report/files.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@

<%= render 'shared/defined_terms_filter' %>

<table class="table">
<caption></caption>
<thead>
<tr>
<th scope="col">File</th>
<th scope="col">Authors</th>
<th scope="col">Departments</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<%= render(partial: 'report/files_without_purpose', collection: @list) || render('files_empty') %>
</tbody>
</table>

</div>

<aside class="content-sup col1q-r">
Expand Down

0 comments on commit d6019c6

Please sign in to comment.