-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAW - dashboard history add changed by column #583
Merged
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d5fb228
added Changed by column and save changer on status change on dashboar…
SamWord db0aaf5
resolved merge conflicts, no specs
SamWord db47b1d
Merge branch 'master' into saw-dashboard-history-add-changed-by-column
SamWord e373585
Merge branch 'master' into saw-dashboard-history-add-changed-by-column
SamWord 61ed009
added update_past_status to service request controller to keep creati…
SamWord 6e625cc
added specs and tweaked controller from last change [#125626111]
SamWord baef1ee
Merge branch 'master' into saw-dashboard-history-add-changed-by-column
SamWord e63f8b5
Fixed merge conflicts [#125626111]
SamWord 962fad5
changed changed_by to changed_by_id, and fixed logic in sr controller…
SamWord 7d4ac07
Merge branch 'master' into saw-dashboard-history-add-changed-by-column
jleonardw9 c036f5e
Merge branch 'saw-dashboard-history-add-changed-by-column' of github.…
jleonardw9 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -23,9 +23,12 @@ class PastStatus < ActiveRecord::Base | |
|
||
belongs_to :sub_service_request | ||
|
||
belongs_to :changer, class_name: 'Identity', foreign_key: 'changed_by' | ||
|
||
attr_accessible :sub_service_request_id | ||
attr_accessible :status | ||
attr_accessible :date | ||
attr_accessible :changed_by | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be changed_by_id |
||
|
||
attr_accessor :changed_to | ||
|
||
|
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
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
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 @@ | ||
class AddChangedByToPastStatuses < ActiveRecord::Migration | ||
def change | ||
add_column :past_statuses, :changed_by, :integer | ||
add_index :past_statuses, :changed_by | ||
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
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
48 changes: 48 additions & 0 deletions
48
spec/controllers/service_requests_controller/get_obtain_research_pricing_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,48 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe ServiceRequestsController do | ||
|
||
describe 'GET obtain_research_pricing' | ||
stub_controller | ||
|
||
let_there_be_lane | ||
let_there_be_j | ||
|
||
before :each do | ||
session[:identity_id] = jug2.id | ||
@protocol = create(:study_without_validations, | ||
primary_pi: jug2) | ||
@organization = create(:provider) | ||
@service_request = create(:service_request_without_validations, | ||
status: 'draft', | ||
protocol: @protocol) | ||
@sub_service_request = create(:sub_service_request, | ||
service_request_id: @service_request.id, | ||
status: 'draft', | ||
organization_id: @organization.id) | ||
end | ||
|
||
context 'Editing a sub_service_request' do | ||
it 'Should create a past_status for the sub_service_request' do | ||
xhr :get, :obtain_research_pricing, | ||
id: @service_request.id, | ||
sub_service_request_id: @sub_service_request.id | ||
|
||
ps = PastStatus.find_by(sub_service_request_id: @sub_service_request.id) | ||
|
||
expect(ps.status).to eq('draft') | ||
end | ||
end | ||
|
||
context 'Editing a service_request' do | ||
it 'Should create a past_status for the sub_service_request' do | ||
xhr :get, :obtain_research_pricing, | ||
id: @service_request.id | ||
|
||
ps = PastStatus.find_by(sub_service_request_id: @sub_service_request.id) | ||
|
||
expect(ps.status).to eq('draft') | ||
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to save off past status and then check against it