Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

If an event's location is set to "0", ignore the location entirely

  • Loading branch information...
commit e0c349c6272081bc00737365811098436baa1593 1 parent bf49f4e
@leocassarani authored
View
4 lib/timetable/event.rb
@@ -92,6 +92,10 @@ def format_attendees(attendees)
end
def format_location(locations)
+ # Sometimes when there is no room, the location is set to '0'
+ # which we ignore completely
+ locations = locations.reject { |loc| loc.strip == '0' }
+
return "" if locations.nil? || locations.empty?
# If all the room names are numeric, then append "Room(s)"
View
2  spec/timetable/fixtures/rooms.html
@@ -71,7 +71,7 @@
<font face="Arial" color="#000000" size="1"><br></font>
</td>
<td bordercolor="#000000">
-<font face="Arial" color="#000000" size="1"><br></font>
+<font face="Arial" color="#000000" size="1">See your Tutor week<br>TUT (1-1) / / 0</font>
</td>
</tr>
<tr valign="top" bgcolor="#FFFFFF">
View
5 spec/timetable/parser_delegate_spec.rb
@@ -8,7 +8,7 @@
it "can parse several different files" do
calendar.should_receive(:parsing_ended).twice
# single has 1 event, multiline has 2
- parser.parse(load_fixture("single.html"))
+ parser.parse(load_fixture("single.html"))
parser.parse(load_fixture("multiline.html"))
delegate.events.should have(3).events
end
@@ -27,12 +27,13 @@
events = delegate.events.sort { |a, b| a.start <=> b.start }
locations = events.map(&:location)
- empty, textual, numeric_single, numeric_multiple, mix = locations
+ empty, textual, numeric_single, numeric_multiple, mix, zero = locations
empty.should be_empty
textual.should == "G16 Sir Alexander Flemming Bldg"
numeric_single.should == "Room 308"
numeric_multiple.should == "Rooms 308, 343, 344"
mix.should == "Clore Lecture Theatre, Room 343"
+ zero.should be_empty
end
end

0 comments on commit e0c349c

Please sign in to comment.
Something went wrong with that request. Please try again.