<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -16,11 +16,18 @@ class ConvertMemberRateToFullRates &lt; ActiveRecord::Migration
     # Add a new Rate object for each Member
     Member.find(:all, :conditions =&gt; ['rate IS NOT NULL']).each do |member|
       say_with_time &quot;Converting rate for #{member.user.to_s} - #{member.project.to_s}&quot; do
+        # Need to find the first date for any TimeEntries  #1924
+        first_time_entry = TimeEntry.find(:first,
+                                          :conditions =&gt; ['project_id = (?) AND user_id = (?)', member.project_id, member.user_id],
+                                          :order =&gt; 'spent_on ASC')
+        date_in_effect = first_time_entry.spent_on if first_time_entry
+        date_in_effect ||= member.created_on
+
         rate = Rate.new({
                           :user =&gt; member.user,
                           :amount =&gt; member.rate,
                           :project =&gt; member.project,
-                          :date_in_effect =&gt; member.created_on
+                          :date_in_effect =&gt; date_in_effect
                         })
         rate.save!
       end</diff>
      <filename>db/migrate/009_convert_member_rate_to_full_rates.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fe11c403811b1a76a6723c36b0d8981b2dbb8e97</id>
    </parent>
  </parents>
  <author>
    <name>Eric Davis</name>
    <email>edavis@littlestreamsoftware.com</email>
  </author>
  <url>http://github.com/edavis10/redmine-budget-plugin/commit/5076b1c88b57c2068aa92cdf694769dbd22d061a</url>
  <id>5076b1c88b57c2068aa92cdf694769dbd22d061a</id>
  <committed-date>2009-01-26T12:05:19-08:00</committed-date>
  <authored-date>2009-01-26T11:59:40-08:00</authored-date>
  <message>Use the first TimeEntry as the date_in_effect in case a user backdates time. #1924</message>
  <tree>e23a0579a16a248aa25fdde8f1374f842556c360</tree>
  <committer>
    <name>Eric Davis</name>
    <email>edavis@littlestreamsoftware.com</email>
  </committer>
</commit>
