<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>@Lathi.net: Calendars and Group Scheduling</title>
    <link>http://blog.lathi.net/articles/2005/09/17/calendars-and-group-scheduling</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>On Life, Fatherhood, Christianity, and Computers</description>
    <item>
      <title>Calendars and Group Scheduling</title>
      <description>&lt;p&gt;It&amp;#8217;s been a pretty good couple of days for Rails coding.  I&amp;#8217;ve done a bunch of validation tweaks, mostly finished the calendar, and begun on group scheduling.&lt;/p&gt;


	&lt;p&gt;I was having problems using embedded hidden forms for all my edit and add links on events.  I did a couple things to improve the performance of the page.  First, I ditched the embedded forms and made them separate page loads.  It was cool to have the embedded forms the magically appear and disappear; I miss it.  Several people suggested I just embed a single edit form and a single add form and use Javascript to update the values before it&amp;#8217;s submitted.  If I were a Javascript stud that&amp;#8217;s what I&amp;#8217;d do.  Maybe when I&amp;#8217;m all grown up I&amp;#8217;ll be smart enough to do that.&lt;/p&gt;


	&lt;p&gt;The other thing I did was change how I tested for events on calendar days.  I had a &lt;code&gt;find_by_day&lt;/code&gt; method that would basically &lt;code&gt;find(:all).select { |expr| expr.occurs_on?(day) }&lt;/code&gt;.  I&amp;#8217;d then loop over the calendar days calling that function.  What I decided to do instead was simply collect all the &lt;code&gt;TimeExpressions&lt;/code&gt; into a single list in the controller and let the view do the select for each day.  This exposes more of the model&amp;#8217;s logic a little.  I like the way the code looks to simply calll &lt;code&gt;find_by_day&lt;/code&gt; for each day.  However, only doing one &lt;code&gt;find&lt;/code&gt; and then doing the &lt;code&gt;selects&lt;/code&gt; in the view shaved a fair amount of time off the page load.&lt;/p&gt;


	&lt;p&gt;So I&amp;#8217;m doing some &amp;#8220;group scheduling&amp;#8221; too.  It&amp;#8217;s quite limited.  The &lt;code&gt;TimeExpressions&lt;/code&gt; I&amp;#8217;ve been working with is really to build a &amp;#8220;free-busy&amp;#8221; schedule of available times to book appointments.  What I need to do is allow a user to invite another user to an appointment.  These two users may have to negotiate an appointment time.  So, it makes sense for my &lt;code&gt;Invitations&lt;/code&gt; to &lt;code&gt;acts_as_versioned&lt;/code&gt;.  I had seen &lt;code&gt;acts_as_versioned&lt;/code&gt; discussed a couple times on the maling list.  Let me just say, I&amp;#8217;m really happy with it.  I was able to set it up without too much fuss.  It works pretty much exactly as advertised.  Thanks &lt;a href="http://techno-weenie.net/"&gt; technoweenie&lt;/a&gt;!&lt;/p&gt;


	&lt;p&gt;Finally, to send out the initial invitations I finally got around to coding some &lt;span class="caps"&gt;AJAX&lt;/span&gt; stuff.  It&amp;#8217;s quite simple; just a link that makes a single request to send the invitation.  I felt so sophisticated!  Only about an hour or so to get it studied, written, tested and committed.&lt;/p&gt;</description>
      <pubDate>Sat, 17 Sep 2005 01:05:04 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:08ae65825caa6ee857c9f637c720496d</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2005/09/17/calendars-and-group-scheduling</link>
      <category>Programming</category>
      <category>Ruby on Rails</category>
      <category>Ruby</category>
      <category>Rails</category>
      <category>Calendars</category>
      <category>AJAX</category>
    </item>
  </channel>
</rss>
