openagent 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
data/lib/openagent/version.rb
CHANGED
@@ -14,7 +14,15 @@ module SIF
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def first_teacher
|
17
|
-
teachers.first
|
17
|
+
teachers.first
|
18
|
+
end
|
19
|
+
|
20
|
+
def first_nonblank_teacher
|
21
|
+
teachers.find{ |t| !t.nil? and !t.empty? }
|
22
|
+
end
|
23
|
+
|
24
|
+
def teacher
|
25
|
+
first_nonblank_teacher || first_teacher || String.new
|
18
26
|
end
|
19
27
|
end
|
20
28
|
end
|
@@ -26,15 +26,23 @@ module SIF
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def first_schedule_info
|
29
|
-
schedule_infos.first
|
29
|
+
schedule_infos.first
|
30
|
+
end
|
31
|
+
|
32
|
+
def first_nonblank_schedule_info
|
33
|
+
schedule_infos.find { |si| !si.teachers.empty? }
|
34
|
+
end
|
35
|
+
|
36
|
+
def schedule_info
|
37
|
+
first_nonblank_schedule_info || first_schedule_info || Common::ScheduleInfo.new
|
30
38
|
end
|
31
39
|
|
32
40
|
def term_info_ref_id
|
33
|
-
|
41
|
+
schedule_info.term_info_ref_id
|
34
42
|
end
|
35
43
|
|
36
44
|
def teacher
|
37
|
-
|
45
|
+
schedule_info.teacher
|
38
46
|
end
|
39
47
|
end
|
40
48
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
<SectionInfo RefId="D3E34B359D75101A8C3D00AA001A1652" SchoolCourseInfoRefId="A2E35B359D75101A8C3D00AA001A0000" SchoolYear="2006">
|
2
2
|
<LocalId>287-1</LocalId>
|
3
3
|
<ScheduleInfoList>
|
4
|
+
<ScheduleInfo TermInfoRefId="099BBC3227490063E97403434C5C2207"/>
|
4
5
|
<ScheduleInfo TermInfoRefId="099BBC3227490063E97403434C5C2207">
|
5
6
|
<TeacherList>
|
6
|
-
<StaffPersonalRefId
|
7
|
+
<StaffPersonalRefId></StaffPersonalRefId>
|
7
8
|
<StaffPersonalRefId>A8C45DC6B3359D75101D00A456BE9000</StaffPersonalRefId>
|
8
9
|
</TeacherList>
|
9
10
|
<SectionRoomList>
|
@@ -8,14 +8,18 @@ describe SIF::Representation::Model::Group::SIS::SectionInfo do
|
|
8
8
|
SIF::Representation::Model::Group::SIS::SectionInfo.new(section_info).from_xml(xml)
|
9
9
|
end
|
10
10
|
|
11
|
-
it
|
11
|
+
it "uses nonblank teachers in schedule_info" do
|
12
|
+
section_info.teacher.should == 'A8C45DC6B3359D75101D00A456BE9000'
|
13
|
+
end
|
14
|
+
|
15
|
+
it "parses" do
|
12
16
|
section_info.ref_id.should == 'D3E34B359D75101A8C3D00AA001A1652'
|
13
17
|
section_info.school_course_info_ref_id.should == 'A2E35B359D75101A8C3D00AA001A0000'
|
14
18
|
section_info.school_year.should == '2006'
|
15
19
|
section_info.local_id.should == '287-1'
|
16
20
|
|
17
|
-
schedule_info = section_info.schedule_infos[
|
18
|
-
schedule_info.teachers[0].should == '
|
21
|
+
schedule_info = section_info.schedule_infos[1]
|
22
|
+
schedule_info.teachers[0].should == ''
|
19
23
|
schedule_info.teachers[1].should == 'A8C45DC6B3359D75101D00A456BE9000'
|
20
24
|
schedule_info.section_rooms[0].should == '94785736AB3671090BDD87593A264086'
|
21
25
|
meeting_times = schedule_info.meeting_times
|
@@ -30,7 +34,7 @@ describe SIF::Representation::Model::Group::SIS::SectionInfo do
|
|
30
34
|
meeting_times[4].timetable_day.should == 'F'
|
31
35
|
meeting_times[4].timetable_period.should == '6'
|
32
36
|
|
33
|
-
schedule_info = section_info.schedule_infos[
|
37
|
+
schedule_info = section_info.schedule_infos[2]
|
34
38
|
schedule_info.teachers[0].should == 'CC543E35B359D75101D00AA001A00703'
|
35
39
|
schedule_info.section_rooms[0].should == '94785736AB3671090BDD87593A264086'
|
36
40
|
meeting_times = schedule_info.meeting_times
|