<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Milestone</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
        <h1>
            <span class="type">Class</span> 
            Milestone 
            
                <span class="parent">&lt; 
                    
                    ActiveRecord::Base
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../files/app/models/milestone_rb.html">app/models/milestone.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<h2 id="label-Schema+Information">Schema Information</h2>

<p>Table name: milestones</p>

<pre>id          :integer          not null, primary key
title       :string(255)      not null
project_id  :integer          not null
description :text
due_date    :date
closed      :boolean          default(FALSE), not null
created_at  :datetime         not null
updated_at  :datetime         not null</pre>

    </div>
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>A</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-author_id">author_id</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-can_be_closed-3F">can_be_closed?</a>,
              </li>
            
              
              <li>
                <a href="#method-i-closed_items_count">closed_items_count</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-expired-3F">expired?</a>,
              </li>
            
              
              <li>
                <a href="#method-i-expires_at">expires_at</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-is_empty-3F">is_empty?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>O</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-open-3F">open?</a>,
              </li>
            
              
              <li>
                <a href="#method-i-open_items_count">open_items_count</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>P</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-participants">participants</a>,
              </li>
            
              
              <li>
                <a href="#method-i-percent_complete">percent_complete</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-total_items_count">total_items_count</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    
      <!-- Section attributes -->
      <div class="sectiontitle">Attributes</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>author_id_of_changes</td>
            <td class='attr-desc'></td>
          </tr>
        
      </table>
    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-author_id">
            
              <b>author_id</b>()
            
            <a href="../classes/Milestone.html#method-i-author_id" name="method-i-author_id" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-author_id_source')" id="l_method-i-author_id_source">show</a>
                
              </p>
              <div id="method-i-author_id_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 82</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">author_id</span>
  <span class="ruby-identifier">author_id_of_changes</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-can_be_closed-3F">
            
              <b>can_be_closed?</b>()
            
            <a href="../classes/Milestone.html#method-i-can_be_closed-3F" name="method-i-can_be_closed-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-can_be_closed-3F_source')" id="l_method-i-can_be_closed-3F_source">show</a>
                
              </p>
              <div id="method-i-can_be_closed-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 70</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">can_be_closed?</span>
  <span class="ruby-identifier">open?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">issues</span>.<span class="ruby-identifier">opened</span>.<span class="ruby-identifier">count</span>.<span class="ruby-identifier">zero?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-closed_items_count">
            
              <b>closed_items_count</b>()
            
            <a href="../classes/Milestone.html#method-i-closed_items_count" name="method-i-closed_items_count" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-closed_items_count_source')" id="l_method-i-closed_items_count_source">show</a>
                
              </p>
              <div id="method-i-closed_items_count_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 46</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">closed_items_count</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">issues</span>.<span class="ruby-identifier">closed</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">merge_requests</span>.<span class="ruby-identifier">closed</span>.<span class="ruby-identifier">count</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-expired-3F">
            
              <b>expired?</b>()
            
            <a href="../classes/Milestone.html#method-i-expired-3F" name="method-i-expired-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-expired-3F_source')" id="l_method-i-expired-3F_source">show</a>
                
              </p>
              <div id="method-i-expired-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">expired?</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">due_date</span>
    <span class="ruby-identifier">due_date</span>.<span class="ruby-identifier">past?</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-expires_at">
            
              <b>expires_at</b>()
            
            <a href="../classes/Milestone.html#method-i-expires_at" name="method-i-expires_at" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-expires_at_source')" id="l_method-i-expires_at_source">show</a>
                
              </p>
              <div id="method-i-expires_at_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 60</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">expires_at</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">due_date</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">due_date</span>.<span class="ruby-identifier">past?</span>
      <span class="ruby-node">&quot;expired at #{due_date.stamp(&quot;Aug 21, 2011&quot;)}&quot;</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-node">&quot;expires at #{due_date.stamp(&quot;Aug 21, 2011&quot;)}&quot;</span>  
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>  
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-is_empty-3F">
            
              <b>is_empty?</b>()
            
            <a href="../classes/Milestone.html#method-i-is_empty-3F" name="method-i-is_empty-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-is_empty-3F_source')" id="l_method-i-is_empty-3F_source">show</a>
                
              </p>
              <div id="method-i-is_empty-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 74</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">is_empty?</span>
  <span class="ruby-identifier">total_items_count</span>.<span class="ruby-identifier">zero?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-open-3F">
            
              <b>open?</b>()
            
            <a href="../classes/Milestone.html#method-i-open-3F" name="method-i-open-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-open-3F_source')" id="l_method-i-open-3F_source">show</a>
                
              </p>
              <div id="method-i-open-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 78</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">open?</span>
  <span class="ruby-operator">!</span><span class="ruby-identifier">closed</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-open_items_count">
            
              <b>open_items_count</b>()
            
            <a href="../classes/Milestone.html#method-i-open_items_count" name="method-i-open_items_count" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-open_items_count_source')" id="l_method-i-open_items_count_source">show</a>
                
              </p>
              <div id="method-i-open_items_count_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 42</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">open_items_count</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">issues</span>.<span class="ruby-identifier">opened</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">merge_requests</span>.<span class="ruby-identifier">opened</span>.<span class="ruby-identifier">count</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-participants">
            
              <b>participants</b>()
            
            <a href="../classes/Milestone.html#method-i-participants" name="method-i-participants" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-participants_source')" id="l_method-i-participants_source">show</a>
                
              </p>
              <div id="method-i-participants_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 38</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">participants</span>
  <span class="ruby-constant">User</span>.<span class="ruby-identifier">where</span>(<span class="ruby-identifier">id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">issues</span>.<span class="ruby-identifier">pluck</span>(<span class="ruby-value">:assignee_id</span>))
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-percent_complete">
            
              <b>percent_complete</b>()
            
            <a href="../classes/Milestone.html#method-i-percent_complete" name="method-i-percent_complete" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-percent_complete_source')" id="l_method-i-percent_complete_source">show</a>
                
              </p>
              <div id="method-i-percent_complete_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 54</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">percent_complete</span>
  ((<span class="ruby-identifier">closed_items_count</span> * <span class="ruby-number">100</span>) <span class="ruby-operator">/</span> <span class="ruby-identifier">total_items_count</span>).<span class="ruby-identifier">abs</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">ZeroDivisionError</span>
  <span class="ruby-number">100</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-total_items_count">
            
              <b>total_items_count</b>()
            
            <a href="../classes/Milestone.html#method-i-total_items_count" name="method-i-total_items_count" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-total_items_count_source')" id="l_method-i-total_items_count_source">show</a>
                
              </p>
              <div id="method-i-total_items_count_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/milestone.rb, line 50</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">total_items_count</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">issues</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">merge_requests</span>.<span class="ruby-identifier">count</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>