Skip to content

Commit

Permalink
Merge 1b1ca5e into 4ee7173
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Friesen committed Feb 26, 2018
2 parents 4ee7173 + 1b1ca5e commit 5f69182
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ SSL=true bin/rails s

Then go to https://localhost:3000

### Development Seeds

`rake bootstrap` - reset the environment's database with basic seed data

In `./lib/tasks/development.rake` you can find Rake tasks for adding data.

### Work Submission

The primary feature (and complexity) is Sipity's work submission show page. Below is a diagram that helps break down its composition.
Expand Down
2 changes: 1 addition & 1 deletion app/decorators/sipity/decorators/dashboard_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def filterable_processing_states
end

def works_scope
repository.find_works_via_search(criteria: criteria, repository: repository)
@works_scope ||= repository.find_works_via_search(criteria: criteria, repository: repository)
end

def works(decorator: WorkDecorator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SearchCriteriaForWorksParameter
class_attribute(*DEFAULT_ATTRIBUTE_NAMES, instance_writer: false)

self.default_page = 1
self.default_per = 15
self.default_per = 8
self.default_user = nil
self.default_proxy_for_type = Models::Work
self.default_processing_state = nil
Expand Down
41 changes: 41 additions & 0 deletions lib/tasks/development.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
namespace :development do
desc 'Add development entries for ULRA (you may want to run `rake bootstrap` beforehand)'
task :seed_ulra => [:environment, 'db:seed'] do
require 'sipity/command_line_context'
# Making an assumption that we have a user. We could use multiple, but roles
# start to get far more complicated.
user = User.first!

# The default context is assumed to be a Rails controller. Instead use the
# command line context, and thus build the entries through much the same
# process as if it were done through the controller. Note this context
# skips authentication/authorization (which you'd need to use something like
# Sipity::Jobs::Core::PerformActionForWorkJob)
context = Sipity::CommandLineContext.new(requested_by: user)
submission_window = context.repository.find_open_submission_windows_by(work_area: 'ulra').first!
form_builder = Sipity::Forms::SubmissionWindows::Ulra::StartASubmissionForm

# I want to test pagination in particular
(1..20).each do |index|
setup_form = form_builder.new(
submission_window: submission_window,
requested_by: context.requested_by,
attributes: {}
)

form = form_builder.new(
submission_window: setup_form.submission_window,
requested_by: context.requested_by,
attributes: {
title: "Hello World #{index}",
award_category: setup_form.award_categories_for_select.sample,
advisor_netid: 'jfriesen',
advisor_name: 'Jeremy Friesen',
course_name: 'My Course',
course_number: "My Course Number"
}
)
form.submit
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Parameters

its(:default_page) { is_expected.to eq(1) }
its(:page?) { is_expected.to eq(true) }
its(:default_per) { is_expected.to eq(15) }
its(:default_per) { is_expected.to eq(8) }
its(:per?) { is_expected.to eq(true) }
its(:default_user) { is_expected.to eq(nil) }
its(:user?) { is_expected.to eq(false) }
Expand Down

0 comments on commit 5f69182

Please sign in to comment.