<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,4 @@
 --Next Release--
-Fix bug on page_event tab when no end date is set
 Make event fields be hidden (in popup) unless set or they click the add date icon
 Add the default time to event in calendar picker, default to top of the hour
 Have the end_date default to X time after start date (1 hour)</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -48,7 +48,7 @@ span.event_date {
 			&lt;td&gt;&lt;%= event.status.name %&gt;&lt;/td&gt; 
 			&lt;td&gt;
 			  &lt;%= event.event_datetime_start.strftime(&quot;%m/%d/%Y %I:%M %p&quot;) %&gt;
-			  &lt;%- if event.event_datetime_end &gt; event.event_datetime_start -%&gt;
+			  &lt;%- if event.event_datetime_end &amp;&amp; event.event_datetime_end &gt; event.event_datetime_start -%&gt;
 			  &amp;ndash;&lt;%= event.event_datetime_end.strftime(&quot;%m/%d/%Y %I:%M %p&quot;) %&gt;
 			  &lt;%- end -%&gt;
 			&lt;/td&gt;</diff>
      <filename>app/views/page_events/index.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,8 @@ module PageEvent::PageExtensions
   module ClassMethods
 		def events_by_month(date = Time.now, status = nil)
 			month_start = date.at_beginning_of_month
-			condition_str = &quot;event_datetime_start &gt;= :month_start OR event_datetime_end &lt; :month_end&quot;
+			condition_str = &quot;(event_datetime_start &gt;= :month_start AND event_datetime_start &lt; :month_end)&quot;
+			condition_str &lt;&lt; &quot; OR (event_datetime_end &gt;= :month_start AND event_datetime_end &lt; :month_end)&quot;
 			condition_str &lt;&lt; &quot; AND status_id = #{status}&quot;  if status
 			
 			Page.find(:all,:conditions =&gt; [condition_str,
@@ -19,7 +20,9 @@ module PageEvent::PageExtensions
 		
 		def event_count_by_month(date = Time.now)
 			month_start = date.at_beginning_of_month
-			Page.count(:conditions =&gt; [&quot;event_datetime_start &gt;= :month_start OR event_datetime_end &lt; :month_end&quot;,
+			condition_str = &quot;(event_datetime_start &gt;= :month_start AND event_datetime_start &lt; :month_end)&quot;
+			condition_str &lt;&lt; &quot; OR (event_datetime_end &gt;= :month_start AND event_datetime_end &lt; :month_end)&quot;	
+			Page.count(:conditions =&gt; [condition_str,
                                 {
                                   :month_start =&gt; month_start,
                                   :month_end =&gt; month_start.next_month</diff>
      <filename>lib/page_event/page_extensions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -26,7 +26,7 @@ describe Page do
 	describe &quot;#upcoming_events&quot; do
 		
 		before(:each) do
-		  create_page &quot;Another event&quot;, :event_datetime =&gt; (Time.now.at_beginning_of_month.next_month - 4.minutes).to_s(:db)
+		  create_page &quot;Another event&quot;, :event_datetime_start =&gt; (Time.now.at_beginning_of_month.next_month - 4.minutes).to_s(:db)
 		end
 		
 	  it &quot;should return the pages for the next 3 upcoming events&quot; do
@@ -40,8 +40,8 @@ describe Page do
 		describe &quot;with more upcoming events&quot; do
 			
 			before(:each) do
-			  create_page &quot;Yet another event&quot;, :event_datetime =&gt; (Time.now.at_beginning_of_month.next_month - 3.minutes).to_s(:db)
-				create_page &quot;Final event&quot;, :event_datetime =&gt; (Time.now.at_beginning_of_month.next_month - 1.minutes).to_s(:db)
+			  create_page &quot;Yet another event&quot;, :event_datetime_start =&gt; (Time.now.at_beginning_of_month.next_month - 3.minutes).to_s(:db)
+				create_page &quot;Final event&quot;, :event_datetime_start =&gt; (Time.now.at_beginning_of_month.next_month - 1.minutes).to_s(:db)
 			end
 			
 		  it &quot;should return only return 3 events, even if there are more&quot; do</diff>
      <filename>spec/models/page_extensions_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,12 +6,15 @@ class PagesScenario &lt; Scenario::Base
   	create_page &quot;Home&quot;, :slug =&gt; &quot;/&quot;, :parent_id =&gt; nil,
 			:published_at =&gt; 2.months.ago.to_s(:db),
 			:body =&gt; &quot;Hello world!&quot;,
-			:event_datetime =&gt; 5.minutes.from_now.to_s(:db)
+			:event_datetime_start =&gt; 5.minutes.from_now.to_s(:db),
+			:event_datetime_end =&gt; 125.minutes.from_now.to_s(:db)
+			
 
 		create_page &quot;No Event&quot;
-		create_page &quot;CMonth First&quot;, :event_datetime =&gt; Time.now.at_beginning_of_month.to_s(:db)
-		create_page &quot;CMonth Last&quot;, :event_datetime =&gt; (Time.now.at_beginning_of_month.next_month - 2.minutes).to_s(:db)
-		create_page &quot;Last Month&quot;, :event_datetime =&gt; (Time.now.at_beginning_of_month.last_month).to_s(:db)
+		create_page &quot;CMonth First&quot;, :event_datetime_start =&gt; Time.now.at_beginning_of_month.to_s(:db), 
+			:event_datetime_end =&gt; (Time.now.at_beginning_of_month + 2.hours).to_s(:db)
+		create_page &quot;CMonth Last&quot;, :event_datetime_start =&gt; (Time.now.at_beginning_of_month.next_month - 2.minutes).to_s(:db)
+		create_page &quot;Last Month&quot;, :event_datetime_start =&gt; (Time.now.at_beginning_of_month.last_month).to_s(:db)
 		
 
   end</diff>
      <filename>spec/scenarios/pages_scenario.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f30003b5e7c5d05f7b8a7fbb78cbc04e9f3d96f6</id>
    </parent>
  </parents>
  <author>
    <name>Marty Haught</name>
    <email>mghaught@gmail.com</email>
  </author>
  <url>http://github.com/mghaught/radiant-page-event/commit/652c6761b1c23b739238e44541fc925dbbc60ced</url>
  <id>652c6761b1c23b739238e44541fc925dbbc60ced</id>
  <committed-date>2008-10-05T20:02:48-07:00</committed-date>
  <authored-date>2008-10-05T20:02:48-07:00</authored-date>
  <message>Fixed condition string in Page.find so that events were found properly in their month
Fixed nil error when no event_datetime_end was specified
Updated TODO</message>
  <tree>efec04b8c374d12a73ce86377ea328eba8063a8f</tree>
  <committer>
    <name>Marty Haught</name>
    <email>mghaught@gmail.com</email>
  </committer>
</commit>
