-
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.
- Loading branch information
Showing
21 changed files
with
128 additions
and
19 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
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
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,11 @@ | ||
class AddVersionToCodes < ActiveRecord::Migration | ||
|
||
def change | ||
add_column :codes, :version, :integer | ||
|
||
Code.all.each do |code| | ||
code.version = 1 | ||
code.save! | ||
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,9 @@ | ||
class LoadNewCodes < ActiveRecord::Migration | ||
def up | ||
load 'db/seed_files/inputs_v2.rb' | ||
end | ||
|
||
def down | ||
puts 'irreversible migration' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"id","parent_id","short_display","description" | ||
"v2_1","","In service training and workshops","It includes all costs related to the implementation of the training (per diems, transport allowances, hall rent, coffee breaks), workshops and similar activities. On-the-job training and/or recurrent training for professionals" | ||
"v2_2","","Pre service training and workshops","Targeted at student and others enrolled in universities, professional schools and similar" | ||
"v2_3","","Advertising, Campaigns and Communication for Health","Costs related to printed, multimedia or electronic material, radio/TV messages, used both for programme communication (like IEC, BCC, sensitization messages) and visibility" | ||
"v2_4","","Salaries: Government personnel (GoR)","Gross salary of personnel directly employed and paid for by GoR ('on statute')" | ||
"v2_5","","Contracted personnel (for GoR)","Gross salary of personnel employed to work in government positions (both clinical and program implementation), not paid for by GoR directly ('contract' or project)" | ||
"v2_6","","Not-government personnel","Gross salary of local and expatriate employees of any other organization/agency (like private sector, not for profit sector, in country TA ...)" | ||
"v2_61","v2_6","TA","Technical assistance" | ||
"v2_62","v2_6","Service Provision","Program implementation and service provision" | ||
"v2_7","","Short term consultants","External consultants not working full time in country" | ||
"v2_8","","Incentives for CHW","Incentives for Community health workers (and related cooperatives)" | ||
"v2_9","","PBF","Performance based financing" | ||
"v2_10","","Drugs","Drugs" | ||
"v2_11","","Commodities and consummable","Mosquito nets, lab consumables, gloves ..." | ||
"v2_12","","Nutritional support","Nutritional support" | ||
"v2_13","","Infrastructure","Infrastructure" | ||
"v2_14","","Non-medical equipment","Non-medical equipment" | ||
"v2_15","","Medical equipment","Medical equipment" | ||
"v2_16","","Vehicles, Transportation & Travel","Vehicles, Transportation & Travel" | ||
"v2_161","v2_16","Vehicles & maintenance","Capital costs of vehicles and maintenance costs" | ||
"v2_162","v2_16","Domestic travel costs","All costs associated with in country travel (i.e. fuel, insurance for vehicles, service hire, travel allowances)" | ||
"v2_163","v2_16","International travel costs","International travel costs" | ||
"v2_17","","Direct financial support","Budget support, CDPF funds, and other direct financial transfer to GoR (national or lower level)" | ||
"v2_18","","OH / General administrative costs","Admin and overhead costs (office rent, utilities, internal communication costs, fringe benefits, security, cleaning...)" | ||
"v2_19","","Other","It refers to all the input that are not explicitly mentioned in the above categories." |
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,14 @@ | ||
require 'csv' | ||
|
||
puts "\n Loading inputs_v2.csv..." | ||
|
||
CSV.foreach("db/seed_files/inputs_v2.csv", headers: true) do |row| | ||
code = Input.find_or_initialize_by_external_id(row["id"]) | ||
parent_code = Input.find_by_external_id(row["parent_id"]) | ||
code.parent_id = parent_code.id if parent_code | ||
code.description = row["description"] | ||
code.short_display = row["short_display"] | ||
code.version = 2 | ||
code.save! | ||
print "." | ||
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
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,21 @@ | ||
require 'spec_helper' | ||
|
||
describe Admin::CodesController do | ||
|
||
describe "#index" do | ||
before :each do | ||
login_as_admin | ||
end | ||
|
||
it "shows latest version only" do | ||
version1 = FactoryGirl.create(:input, version: 1) | ||
version2 = FactoryGirl.create(:input, version: 2) | ||
|
||
get :index, filter: 'Inputs' | ||
|
||
codes = assigns(:codes) | ||
codes.should include(version2) | ||
codes.should_not include(version1) | ||
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