Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions app/controllers/report_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,7 @@ def holds_by_source
@list = filter_holds_by_source term_filtered
end

def index
report = Report.new
@terms = Thesis.pluck(:grad_date).uniq.sort
@data = report.index_data
end
def index; end

def term
term = params[:graduation] ? params[:graduation].to_s : 'all'
Expand Down
51 changes: 13 additions & 38 deletions app/views/report/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,19 @@

<div class="layout-3q1q layout-band">
<div class="col3q">
<h3 class="title title-page">Thesis dashboard</h3>
<h3 class="title title-page">Report dashboard</h3>

<div class="well">
<p>The tables below summarize information about the thesis records which have been supplied to this application across academic terms.</p>
<p>Click on a column heading to see more detailed information about the theses from that term.</p>
</div>

<%= render 'shared/whodunnit_accuracy_statement' %>

<% @data.each do |table| %>
<table class="table table-simplified table-<%= table[0].gsub(" ", "-").downcase %>" style="margin-top: 4em;">
<caption class="hd-4"><%= table[0].gsub("-", " ").capitalize %></caption>
<thead>
<tr>
<td>&nbsp;</td>
<% @terms.each do |term| %>
<th scope="col"><%= link_to( term.in_time_zone('Eastern Time (US & Canada)').strftime('%b %Y'), report_term_path(:graduation => term) )%></th>
<% end %>
</tr>
</thead>
<tbody>
<% table[1].each do |row| %>
<tr>
<th scope="row"><%= row[:label] %></th>
<% if row[:data] %>
<% row[:data].each do |cell| %>
<td><%= cell[1] %></td>
<% end %>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<% end %>

<h4>Available reports</h4>
<ul>
<li><%= link_to("Thesis authors without confirmed graduation", report_authors_not_graduated_path) %></li>
<li><%= link_to("Theses without files", report_empty_theses_path) %></li>
<li><%= link_to("Unreleased holds which have ended", report_expired_holds_path) %></li>
<li><%= link_to("Files without purpose", report_files_path) %></li>
<li><%= link_to("Holds by source", report_holds_by_source_path) %></li>
<li><%= link_to("ProQuest forms", report_proquest_files_path) %></li>
<li><%= link_to("ProQuest opt-in status", report_proquest_status_path) %></li>
<li><%= link_to("Theses submitted by students", report_student_submitted_theses_path) %></li>
<li><%= link_to("Thesis information by term", report_term_path) %></li>
</ul>
</div>

<aside class="content-sup col1q-r">
<%= render 'shared/report_submenu' %>
</aside>
</div>
22 changes: 7 additions & 15 deletions test/controllers/report_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,61 +49,53 @@ def create_thesis_with_whodunnit(user)
end

# ~~~~~~~~~~~~~~~~~~~~ Report dashboard ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test 'summary report exists' do
test 'report dashboard exists' do
sign_in users(:admin)
get report_index_path
assert_response :success
end

test 'anonymous users are prompted to log in by summary report' do
test 'anonymous users are prompted to log in by report dashboard' do
# Note that nobody is signed in.
get report_index_path
assert_response :redirect
assert_redirected_to '/login'
end

test 'basic users cannot see summary report' do
test 'basic users cannot see report dashboard' do
sign_in users(:basic)
get report_index_path
assert_redirected_to '/'
follow_redirect!
assert_select 'div.alert', text: 'Not authorized.', count: 1
end

test 'submitters cannot see summary report' do
test 'submitters cannot see report dashboard' do
sign_in users(:transfer_submitter)
get report_index_path
assert_redirected_to '/'
follow_redirect!
assert_select 'div.alert', text: 'Not authorized.', count: 1
end

test 'processors can see summary report' do
test 'processors can see report dashboard' do
sign_in users(:processor)
get report_index_path
assert_response :success
end

test 'thesis_admins can see summary report' do
test 'thesis_admins can see report dashboard' do
sign_in users(:thesis_admin)
get report_index_path
assert_response :success
end

test 'admins can see summary report' do
test 'admins can see report dashboard' do
sign_in users(:admin)
get report_index_path
assert_response :success
end

# ~~~~ Dashboard features

test 'summary report has links to term-specific pages for all terms' do
sign_in users(:processor)
get report_index_path
assert_select 'table:first-of-type thead a', count: Thesis.pluck(:grad_date).uniq.count
end

# ~~~~~~~~~~~~~~~~~~~~ Report empty theses ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test 'empty theses report exists' do
sign_in users(:admin)
Expand Down