diff --git a/app/importers/com_data/com_effort_populate_db.rb b/app/importers/com_data/com_effort_populate_db.rb
index 703d50f..3171b99 100644
--- a/app/importers/com_data/com_effort_populate_db.rb
+++ b/app/importers/com_data/com_effort_populate_db.rb
@@ -24,7 +24,7 @@ def populate
faculty:)
com_effort.hours ||= 0
- com_effort.hours += row['UME_CALCULATED_TEACHING_WHILE_NON_BILLING_EFFORT__HRS_'].to_f
+ com_effort.hours += row['UME_CALCULATED_TEACHING_WHILE_NON_BILLING_EFFORT__HRS_'].to_d
com_effort.save!
rescue ActiveRecord::RecordNotUnique
diff --git a/app/importers/com_data/com_effort_xml_builder.rb b/app/importers/com_data/com_effort_xml_builder.rb
index 499e02f..4cbd9ad 100644
--- a/app/importers/com_data/com_effort_xml_builder.rb
+++ b/app/importers/com_data/com_effort_xml_builder.rb
@@ -18,7 +18,7 @@ def build_xml_effort(batch)
batch.each do |faculty|
xml.Record('PennStateHealthUsername' => faculty.com_id) do
faculty.com_efforts.each do |com_effort|
- event_date = Date.strptime(com_effort.event_date, '%m/%d/%y')
+ event_date = Date.strptime(com_effort.event_date, '%m/%d/%Y')
xml.INSTRUCT_TAUGHT do
xml.COURSE_YEAR_ com_effort.course_year, access: 'READ_ONLY'
xml.COURSE_TITLE_ com_effort.course, access: 'READ_ONLY'
diff --git a/db/migrate/20231214203515_change_hours_data_type_in_com_efforts.rb b/db/migrate/20231214203515_change_hours_data_type_in_com_efforts.rb
new file mode 100644
index 0000000..d2f644c
--- /dev/null
+++ b/db/migrate/20231214203515_change_hours_data_type_in_com_efforts.rb
@@ -0,0 +1,9 @@
+class ChangeHoursDataTypeInComEfforts < ActiveRecord::Migration[7.0]
+ def up
+ change_column :com_efforts, :hours, :decimal, precision: 10, scale: 2
+ end
+
+ def down
+ change_column :com_efforts, :hours, :integer
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index beaac06..691acc4 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -28,7 +28,7 @@
t.string "event_type"
t.string "faculty_name"
t.string "event"
- t.integer "hours"
+ t.decimal "hours", precision: 10, scale: 2
t.bigint "faculty_id"
t.string "event_date"
t.index ["com_id", "course", "event", "event_date"], name: "index_com_efforts_on_com_id_and_course_and_event_and_event_date", unique: true, length: { course: 50, event: 50 }
diff --git a/spec/fixtures/ume_faculty_effort.csv b/spec/fixtures/ume_faculty_effort.csv
index 1532f70..1403ae6 100644
--- a/spec/fixtures/ume_faculty_effort.csv
+++ b/spec/fixtures/ume_faculty_effort.csv
@@ -1,3 +1,3 @@
FACULTY_USERNAME,FACULTY_NAME,COURSE,COURSE_YEAR,EVENT_TYPE,EVENT,EVENT_DATE,UME_CALCULATED_TEACHING_WHILE_NON_BILLING_EFFORT__HRS_
-lskywalker,Skywalker Luke,the Force,1976-1977,Lecture,FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid,5/25/77 10:00,2
-hgranger,Granger Hermione,Potions,1997-1998,Sm Grp Facilitation,FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid,6/26/97 9:45,7
+lskywalker,Skywalker Luke,the Force,1976-1977,Lecture,FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid,5/25/1977 10:00,2
+hgranger,Granger Hermione,Potions,1997-1998,Sm Grp Facilitation,FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid,6/26/1997 9:45,7
diff --git a/spec/importers/com_data/com_effort_populate_db_spec.rb b/spec/importers/com_data/com_effort_populate_db_spec.rb
index d9a61c1..ccaacb5 100644
--- a/spec/importers/com_data/com_effort_populate_db_spec.rb
+++ b/spec/importers/com_data/com_effort_populate_db_spec.rb
@@ -9,13 +9,13 @@
arr_of_hashes = []
keys = headers
data_arr << ['lskywalker', 'Skywalker Luke', 'the Force', '1976-1977', 'Lecture',
- 'FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid', '5/25/77 10:00', 2]
+ 'FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid', '5/25/1977 10:00', 2.5]
data_arr << ['lskywalker', 'Skywalker Luke', 'the Force', '1976-1977', 'Lecture',
- 'FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid', '5/25/77 1:00', 4]
+ 'FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid', '5/25/1977 1:00', 4]
data_arr << ['hgranger', 'Granger Hermione', 'Potions', '1997-1998', 'Sm Grp Facilitation',
- 'FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid', '6/26/97 9:45', 7]
+ 'FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid', '6/26/1997 9:45', 7]
data_arr << ['hgranger', 'Granger Hermione', 'Dark Arts', '2001-2002', 'Sm Grp Facilitation',
- 'FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid', '11/1/01 12:00', 8]
+ 'FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid', '11/1/2001 12:00', 8]
data_arr.each { |a| arr_of_hashes << keys.zip(a).to_h }
arr_of_hashes
end
@@ -52,7 +52,7 @@
expect(ComEffort.find_by(com_id: 'hgranger').hours).to eq(8)
expect(ComEffort.find_by(com_id: 'hgranger').event_type).to eq('Sm Grp Facilitation')
expect(ComEffort.find_by(com_id: 'hgranger').event).to eq('FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid')
- expect(ComEffort.find_by(com_id: 'lskywalker').hours).to eq(6)
+ expect(ComEffort.find_by(com_id: 'lskywalker').hours).to eq(6.5)
expect(ComEffort.find_by(com_id: 'lskywalker').event_type).to eq('Lecture')
expect(ComEffort.find_by(com_id: 'lskywalker').faculty).to eq(faculty2)
end
diff --git a/spec/importers/com_data/com_effort_xml_builder_spec.rb b/spec/importers/com_data/com_effort_xml_builder_spec.rb
index fa704c6..afdff09 100644
--- a/spec/importers/com_data/com_effort_xml_builder_spec.rb
+++ b/spec/importers/com_data/com_effort_xml_builder_spec.rb
@@ -8,23 +8,23 @@
'COURSE_YEAR' => '1976-1977',
'EVENT_TYPE' => 'Lecture',
'EVENT' => 'FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid',
- 'EVENT_DATE' => '5/25/77',
- 'UME_CALCULATED_TEACHING_WHILE_NON_BILLING_EFFORT__HRS_' => 2 },
+ 'EVENT_DATE' => '5/25/1977',
+ 'UME_CALCULATED_TEACHING_WHILE_NON_BILLING_EFFORT__HRS_' => 2.5 },
{ 'FACULTY_USERNAME' => 'hgranger',
'FACULTY_NAME' => 'Granger Hermione',
'COURSE' => 'Potions',
- 'COURSE_YEAR' => '1997-1998',
+ 'COURSE_YEAR' => '2022-2023',
'EVENT_TYPE' => 'Sm Grp Facilitation',
'EVENT' => 'FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid',
- 'EVENT_DATE' => '6/26/97',
- 'UME_CALCULATED_TEACHING_WHILE_NON_BILLING_EFFORT__HRS_' => 7 },
+ 'EVENT_DATE' => '6/26/2023',
+ 'UME_CALCULATED_TEACHING_WHILE_NON_BILLING_EFFORT__HRS_' => 7.25 },
{ 'FACULTY_USERNAME' => 'notCOM',
'FACULTY_NAME' => 'Not MD',
'COURSE' => 'test',
'COURSE_YEAR' => '2022-2023',
'EVENT_TYPE' => 'Lacture',
'EVENT' => 'Test Event for employee not in College of Medicine',
- 'EVENT_DATE' => '1/1/23',
+ 'EVENT_DATE' => '1/1/2023',
'UME_CALCULATED_TEACHING_WHILE_NON_BILLING_EFFORT__HRS_' => 1 }]
end
@@ -61,19 +61,19 @@
May
25
1977
- 2
+ 2.5
- 1997-1998
+ 2022-2023
Potions
FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid
Sm Grp Facilitation
June
26
- 1997
- 7
+ 2023
+ 7.25
diff --git a/spec/integration/ai_integration/com_effort_integration_spec.rb b/spec/integration/ai_integration/com_effort_integration_spec.rb
index 753fc81..bdb671d 100644
--- a/spec/integration/ai_integration/com_effort_integration_spec.rb
+++ b/spec/integration/ai_integration/com_effort_integration_spec.rb
@@ -79,14 +79,14 @@ def effort_body
"FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid\n " +
"Sm Grp Facilitation\n " +
"June\n 26\n " +
- "1997\n 7\n " +
+ "1997\n 7.0\n " +
"\n \n \n \n " +
"1976-1977\n " +
"the Force\n " +
"FTF REQ Various Rooms 10-12 PBL - EndoRepro PBL 1402 - Thyroid\n " +
"Lecture\n May\n " +
"25\n 1977\n " +
- "2\n \n \n\n"
+ "2.0\n \n \n\n"
end
def error_message
diff --git a/spec/models/com_effort_spec.rb b/spec/models/com_effort_spec.rb
index 42ff9d3..6095ff4 100644
--- a/spec/models/com_effort_spec.rb
+++ b/spec/models/com_effort_spec.rb
@@ -10,7 +10,7 @@
it { is_expected.to have_db_column(:faculty_name).of_type(:string) }
it { is_expected.to have_db_column(:event).of_type(:string) }
it { is_expected.to have_db_column(:event).of_type(:string) }
- it { is_expected.to have_db_column(:hours).of_type(:integer) }
+ it { is_expected.to have_db_column(:hours).of_type(:decimal) }
it { is_expected.to have_db_index(%i[com_id course event event_date]).unique(true) }
it { is_expected.to have_db_index([:faculty_id]) }