-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial form for circ stats management report
- Loading branch information
Showing
10 changed files
with
220 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
### | ||
# Controller to handle the Circulation Statistics Report | ||
### | ||
class CirculationStatisticsReportsController < ApplicationController | ||
def new | ||
@circulation_statistics_report = CirculationStatisticsReport.new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# app/models/circulation_statistics_report.rb | ||
class CirculationStatisticsReport | ||
include ActiveModel::Model | ||
attr_accessor :email, :libraries, :source, :range_type, :low_callnum_range, :hi_callnum_range | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# app/models/uni_libs_locs.rb | ||
class UniLibsLocs < ActiveRecord::Base | ||
self.table_name = 'uni_libs_locs' | ||
|
||
def self.libraries | ||
UniLibsLocs.select(:library).distinct.where.not(library: nil).order(:library).pluck(:library) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
<h2>Circulation Statistics Report Request</h2> | ||
<%= form_for @circulation_statistics_report, multipart: true, class: 'form-group' do |f| %> | ||
<% if @circulation_statistics_report.errors.any? %> | ||
<div id="error_explanation"> | ||
<ul> | ||
<% @circulation_statistics_report.errors.full_messages.each do |msg| %> | ||
<li><%= msg %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
<div> | ||
<div class='form-group row'> | ||
<%= f.label :email, 'Email for notification when the report is ready:', class: 'col-sm-5 form-control-label' %> | ||
<div class='col-sm-10'> | ||
<%= f.text_field 'email', class: 'form-control' %> | ||
</div> | ||
</div> | ||
<div class='form-group row'> | ||
<%= f.label :libraries, 'Select libraries to collect stats for:', class: 'col-sm-5 form-control-label' %> | ||
<div class='col-sm-10'> | ||
<%= f.select :libraries, UniLibsLocs.libraries, {}, {multiple: true, size: 6, selected: 'none', class: 'form-control'} %> | ||
</div> | ||
</div> | ||
<div class='form-group row'> | ||
<%= f.label :source, 'Select from:', class: 'col-sm-3 form-control-label' %> | ||
<div class='col-sm-10'> | ||
<%= f.radio_button :source, 'All of Symphony' %> All of Symphony<br /> | ||
<%= f.radio_button :source, 'Google candidates (standard barcode)' %> Google candidates (standard barcode)<br /> | ||
<%= f.radio_button :source, 'Google candidates (auto-barcode)' %> Google candidates (auto-barcode)<br /> | ||
</div> | ||
</div> | ||
<div class='form-group row'> | ||
<%= f.label :range_type, 'Type of selection of records to include in the report: (See examples of call number options below)', class: 'col-sm-7 form-control-label' %> | ||
<div class='col-sm-10'> | ||
<%= f.radio_button :range_type, 'LC Letters Range: All LC call numbers beginning with specified letter(s) or range of letters' %> LC Letters Range: All LC call numbers beginning with specified letter(s) or range of letters<br /> | ||
<%= f.radio_button :range_type, 'Classic Selection: LC numerical range all beginning with same letter(s), or any range of Dewey numbers' %> Classic Selection: LC numerical range all beginning with same letter(s), or any range of Dewey numbers<br /> | ||
<%= f.radio_button :range_type, 'Other call numbers: All that are neither LC nor Dewey, optionally filtered by start of call number' %> Other call numbers: All that are neither LC nor Dewey, optionally filtered by start of call number<br /> | ||
<%= f.radio_button :range_type, 'Upload a barcode list (Any call numbers. "Library" and "Select from" options on this page ignored)' %> Upload a barcode list (Any call numbers. "Library" and "Select from" options on this page ignored)<br /> | ||
</div> | ||
</div> | ||
<p>Enter a letter or range of letters for circulation statistics on all LC call numbers beginning with the letter(s).</p> | ||
<div class='form-group row'> | ||
<%= f.label :low_callnum_range, 'Lowest letter(s) of LC call number range. One or two letters required or one letter followed by # symbol.' %> | ||
<div class='col-md-1'> | ||
<%= f.text_field :low_callnum_range, maxlength: 2, class: 'form-control' %><br/> | ||
</div> | ||
</div> | ||
<div class='form-group row'> | ||
<%= f.label :hi_callnum_range, 'Highest letter(s) of LC call number range. Same number of letters as in first field, or leave blank for only letter(s) in first field.' %> | ||
<div class='col-md-1'> | ||
<%= f.text_field :hi_callnum_range, maxlength: 2, class: 'form-control' %><br/> | ||
</div> | ||
</div> | ||
<!-- get libraries from uni_libs_locs --> | ||
<!-- UniLibsLocs.select(:library).distinct.where.not(library: nil).order(:library) --> | ||
<!-- see CIRC_STATS_RPT body --> | ||
<!-- select multiple with :multiple=>true --> | ||
<div><%= f.submit 'Submit request', class: 'btn' %></div><br/> | ||
</div> | ||
<% end %> | ||
<div class="btn-group"> | ||
<%= main_menu_button %> | ||
</div> | ||
<h4>Call number range examples for LC Letters Range:</h4> | ||
<div> | ||
<table class='table table-bordered'> | ||
<tbody> | ||
<tr> | ||
<td>H</td> | ||
<td></td> | ||
<td>selects all LC call numbers starting with H (including HA, HB, etc.)</td> | ||
</tr> | ||
<tr> | ||
<td>H#</td> | ||
<td></td> | ||
<td>selects all LC call numbers starting with H followed by digit or cutter, <strong>not</strong> HA, HB, etc. (<em>Same as Classic Selection H 0 9999 below</em>)</td> | ||
</tr> | ||
<tr> | ||
<td>H</td> | ||
<td>K</td> | ||
<td>selects all LC call numbers starting with H, I, J or K</td> | ||
</tr> | ||
<tr> | ||
<td>HB</td> | ||
<td></td> | ||
<td>selects all LC call numbers starting with HB (<em>Same as Classic Selection HB 0 9999 below</em>)</td> | ||
</tr> | ||
<tr> | ||
<td>HB</td> | ||
<td>HD</td> | ||
<td>selects all LC call numbers starting with HB, HC or HD</td> | ||
</tr> | ||
<tr> | ||
<td>A</td> | ||
<td>Z</td> | ||
<td>selects all LC call numbers</td> | ||
</tr> | ||
<tr> | ||
<td class='text-danger'>H#</td> | ||
<td class='text-danger'>HC</td> | ||
<td class='text-danger'>NOT ALLOWED. With # used in first input field, second field must be empty.</td> | ||
</tr> | ||
<tr> | ||
<td class='text-danger'>HB</td> | ||
<td class='text-danger'>JA</td> | ||
<td class='text-danger'>NOT ALLOWED. With 2 letters in each input field, both fields must have the same first letter.</td> | ||
</tr> | ||
<tr> | ||
<td class='text-danger'>H</td> | ||
<td class='text-danger'>HD</td> | ||
<td class='text-danger'>NOT ALLOWED. Can't have one letter in one field and two letters in the other field.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<h4>Call number range examples for Classic Selection: </h4> | ||
<div> | ||
<table class='table table-bordered'> | ||
<tbody> | ||
<tr> | ||
<td>H</td> | ||
<td>0</td> | ||
<td>9999</td> | ||
<td>selects all LC call numbers starting with H followed by digit or cutter (<em>Does NOT include call starting HA, HB, etc</em>)</td> | ||
</tr> | ||
<tr> | ||
<td>HB</td> | ||
<td>120</td> | ||
<td>2000</td> | ||
<td>selects all LC call numbers from HB120 to HB2000.9999</td> | ||
</tr> | ||
<tr> | ||
<td>HB</td> | ||
<td>0</td> | ||
<td>9999</td> | ||
<td>selects all LC call numbers starting with HB (<em>Same as LC Letters Range HB above</em>)</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td>382</td> | ||
<td>499</td> | ||
<td>selects all Dewey call numbers from 382 to 499.9999</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td>0</td> | ||
<td>999</td> | ||
<td>selects all Dewey call numbers</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<div>HB to HC is not possible with Classic Selection. Use LC Letters Range for selections like that.</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class CreateUniLibsLocs < ActiveRecord::Migration | ||
def change | ||
create_table :uni_libs_locs do |t| | ||
t.string :library | ||
t.string :home_loc | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
spec/controllers/circulation_statistics_reports_controller_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe CirculationStatisticsReportsController, type: :controller do | ||
describe 'get#new' do | ||
it 'renders the correct template' do | ||
stub_current_user(FactoryGirl.create(:authorized_user)) | ||
get 'new' | ||
expect(response).to render_template('new') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FactoryGirl.define do | ||
factory :uni_libs_locs do | ||
library 'SAL3' | ||
home_loc 'PAGE-MU' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe UniLibsLocs, type: :model do | ||
it 'has a valid factory' do | ||
expect(FactoryGirl.create(:uni_libs_locs)).to be_valid | ||
end | ||
|
||
it 'returns an array of library names' do | ||
FactoryGirl.create(:uni_libs_locs) | ||
expect(UniLibsLocs.libraries).to eq(['SAL3']) | ||
end | ||
end |