openagent 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module OpenAgent
2
- VERSION = '0.7.6' unless defined?(OpenAgent::VERSION)
2
+ VERSION = '0.7.7' unless defined?(OpenAgent::VERSION)
3
3
  end
@@ -5,7 +5,14 @@ module SIF
5
5
  include Virtus.model
6
6
 
7
7
  attribute :timetable_day, String
8
+ alias_method :day, :timetable_day
9
+
8
10
  attribute :timetable_period, String
11
+ alias_method :period, :timetable_period
12
+
13
+ def expression
14
+ "#{period}(#{day})"
15
+ end
9
16
  end
10
17
  end
11
18
  end
@@ -5,9 +5,13 @@ module SIF
5
5
  include Virtus.model
6
6
 
7
7
  attribute :term_info_ref_id
8
- attribute :teachers, Array[String]
9
- attribute :section_rooms, Array[String]
10
- attribute :meeting_times, Array[MODEL_COMMON::MeetingTime]
8
+ attribute :teachers, Array[String], :default => []
9
+ attribute :section_rooms, Array[String], :default => []
10
+ attribute :meeting_times, Array[Common::MeetingTime], :default => []
11
+
12
+ def first_meeting_time
13
+ meeting_times.first || Common::MeetingTime.new
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -15,6 +15,10 @@ module SIF
15
15
  attribute :addresses, Array[MODEL_COMMON::Address]
16
16
  attribute :phone_numbers, Array[MODEL_COMMON::PhoneNumber]
17
17
  attribute :emails, Array[MODEL_COMMON::Email]
18
+
19
+ def first_email
20
+ emails.map{ |email| email.value.split(/[,;\s]\s?/) }.flatten.first
21
+ end
18
22
  end
19
23
  end
20
24
  end
@@ -19,6 +19,11 @@ module SIF
19
19
  attribute :summer_school, String
20
20
  attribute :school_course_info_override, Common::SchoolCourseInfoOverride
21
21
 
22
+ def schedule_info_for_term(term_info_ref_id)
23
+ schedule_infos.find do |si|
24
+ si.term_info_ref_id == term_info_ref_id
25
+ end || Common::ScheduleInfo.new
26
+ end
22
27
  end
23
28
  end
24
29
  end
@@ -14,6 +14,14 @@ module SIF
14
14
  attribute :schedule_info_overrides, Array[Common::ScheduleInfoOverride]
15
15
  attribute :credits_attempted, Common::CreditsAttempted
16
16
 
17
+ def status(as_of=Date.today)
18
+ if as_of >= entry_date && as_of < exit_date
19
+ 'active'
20
+ else
21
+ 'deleted'
22
+ end
23
+ end
24
+
17
25
  end
18
26
  end
19
27
  end
@@ -45,4 +45,9 @@ describe SIF::Representation::Model::Group::SIS::StudentSectionEnrollment do
45
45
  student_se.credits_attempted.type.should == '0588'
46
46
  student_se.credits_attempted.value.should == '1'
47
47
  end
48
+
49
+ it 'has active status' do
50
+ student_se.status(Date.new(2001, 10, 1)).should == 'active'
51
+ student_se.status(Date.new(2010, 10, 1)).should == 'deleted'
52
+ end
48
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openagent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-11-26 00:00:00.000000000 Z
14
+ date: 2013-11-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake