aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/chouette/time_table.rb5
-rw-r--r--spec/models/chouette/time_table_spec.rb41
-rw-r--r--spec/models/time_table_combination_spec.rb4
3 files changed, 11 insertions, 39 deletions
diff --git a/app/models/chouette/time_table.rb b/app/models/chouette/time_table.rb
index 85f1e8c6e..2d329bcc6 100644
--- a/app/models/chouette/time_table.rb
+++ b/app/models/chouette/time_table.rb
@@ -478,8 +478,6 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord
if !another_tt.periods.empty?
# copy periods
self.periods = another_tt.clone_periods
- # set valid_days
- self.int_day_types = another_tt.int_day_types
end
# merge dates
self.dates ||= []
@@ -543,7 +541,6 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord
self.dates.clear
days.each {|d| self.dates << Chouette::TimeTableDate.new( :date =>d, :in_out => true)}
self.periods.clear
- self.int_day_types = 0
self.dates.to_a.sort! { |a,b| a.date <=> b.date}
self.save!
end
@@ -558,8 +555,6 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord
days = self.effective_days - days_to_exclude
self.dates.clear
self.periods.clear
- self.int_day_types = 0
-
days.each {|d| self.dates << Chouette::TimeTableDate.new( :date =>d, :in_out => true)}
self.dates.to_a.sort! { |a,b| a.date <=> b.date}
diff --git a/spec/models/chouette/time_table_spec.rb b/spec/models/chouette/time_table_spec.rb
index 89f70310e..1e5972c04 100644
--- a/spec/models/chouette/time_table_spec.rb
+++ b/spec/models/chouette/time_table_spec.rb
@@ -999,7 +999,7 @@ end
expect(subject.periods[2].period_start).to eq(Date.new(2014, 8, 1))
expect(subject.periods[2].period_end).to eq(Date.new(2014, 8, 12))
end
- it "should have common day_types" do
+ it "should not modify day_types" do
expect(subject.int_day_types).to eq(4|16|128)
end
it "should have dates for thursdays and fridays" do
@@ -1033,9 +1033,6 @@ end
it "should have no period" do
expect(subject.periods.size).to eq(0)
end
- it "should have no day_types" do
- expect(subject.int_day_types).to eq(0)
- end
it "should have date all common days" do
expect(subject.dates.size).to eq(3)
expect(subject.dates[0].date).to eq(Date.new(2014,7,16))
@@ -1064,7 +1061,7 @@ end
it "should have 0 period" do
expect(subject.periods.size).to eq(0)
end
- it "should have no day_types" do
+ it "should not modify day_types" do
expect(subject.int_day_types).to eq(0)
end
it "should have date reduced for period" do
@@ -1089,8 +1086,8 @@ end
it "should have 0 result periods" do
expect(subject.periods.size).to eq(0)
end
- it "should have no day_types" do
- expect(subject.int_day_types).to eq(0)
+ it "should not modify day_types" do
+ expect(subject.int_day_types).to eq(4|8|16)
end
it "should have 1 date " do
expect(subject.dates.size).to eq(1)
@@ -1119,9 +1116,6 @@ end
it "should have 0 periods" do
expect(subject.periods.size).to eq(0)
end
- it "should have 0 day_types" do
- expect(subject.int_day_types).to eq(0)
- end
it "should have only dates " do
expect(subject.dates.size).to eq(11)
expect(subject.dates[0].date).to eq(Date.new(2014,6,30))
@@ -1160,7 +1154,7 @@ end
it "should have 0 period" do
expect(subject.periods.size).to eq(0)
end
- it "should have no remained day_types" do
+ it "should not modify day_types" do
expect(subject.int_day_types).to eq(0)
end
it "should have date reduced for period" do
@@ -1189,9 +1183,6 @@ end
it "should have 0 result periods" do
expect(subject.periods.size).to eq(0)
end
- it "should have no remained day_types" do
- expect(subject.int_day_types).to eq(0)
- end
it "should have dates for period reduced" do
expect(subject.dates.size).to eq(4)
expect(subject.dates[0].date).to eq(Date.new(2014,7,3))
@@ -1223,9 +1214,6 @@ end
it "should have 0 result periods" do
expect(subject.periods.size).to eq(0)
end
- it "should have no remained day_types" do
- subject.int_day_types == 0
- end
it "should have 3 dates left" do
expect(subject.dates.size).to eq(3)
expect(subject.dates[0].date).to eq(Date.new(2014,7,16))
@@ -1259,10 +1247,6 @@ end
expect(subject.periods.size).to eq(0)
end
- it "should have no remained day_types" do
- subject.int_day_types == 0
- end
-
it "should have 0 dates left" do
expect(subject.dates.size).to eq(0)
end
@@ -1287,10 +1271,6 @@ end
expect(subject.periods.size).to eq(0)
end
- it "should have 0 day_types" do
- expect(subject.int_day_types).to eq(0)
- end
-
it "should have 6 dates " do
expect(subject.dates.size).to eq(6)
expect(subject.dates[0].date).to eq(Date.new(2014,8,11))
@@ -1329,8 +1309,8 @@ end
end
end
- it "should have 0 day_types" do
- expect(subject.int_day_types).to eq(0)
+ it "should not modify day_types" do
+ expect(subject.int_day_types).to eq(4|8|16)
end
it "should have 1 dates " do
@@ -1368,8 +1348,8 @@ end
end
end
- it "should have 0 day_types" do
- expect(subject.int_day_types).to eq(0)
+ it "should not modify day_types" do
+ expect(subject.int_day_types).to eq(4|8|16)
end
it "should have only 1 dates " do
@@ -1399,9 +1379,6 @@ end
it "should have same 0 result periods" do
expect(subject.periods.size).to eq(0)
end
- it "should have 0 day_types" do
- expect(subject.int_day_types).to eq(0)
- end
it "should have 0 dates " do
expect(subject.dates.size).to eq(0)
end
diff --git a/spec/models/time_table_combination_spec.rb b/spec/models/time_table_combination_spec.rb
index 0a8b3296a..3e60fa444 100644
--- a/spec/models/time_table_combination_spec.rb
+++ b/spec/models/time_table_combination_spec.rb
@@ -87,7 +87,7 @@ describe TimeTableCombination, :type => :model do
end
it "should intersect combined to source" do
- expect(source.int_day_types).to eq(0)
+ expect(source.int_day_types).to eq(508)
expect(source.periods.size).to eq(1)
expect(source.dates.size).to eq(0)
@@ -119,7 +119,7 @@ describe TimeTableCombination, :type => :model do
end
it "should disjoin combined to source" do
- expect(source.int_day_types).to eq(0)
+ expect(source.int_day_types).to eq(508)
expect(source.periods.size).to eq(1)
expect(source.dates.size).to eq(0)