Sha256: b779a24c4987f0cd36370577dfdd36e1dac5b2b2cb4083006044744f20d7e787

Contents?: true

Size: 883 Bytes

Versions: 3

Compression:

Stored size: 883 Bytes

Contents

#! /usr/bin/env ruby
# coding: utf-8

#require "sculd/event.rb"
#require "sculd/plan.rb"

#
#
#
class Sculd::Plan::Todo < Sculd::Plan

  SYMBOL_CHAR = "+"
  DEFAULT_OPTION = 7

  #
  def priority(today)
    #@option = 1 if @option < 1
    option = @option || DEFAULT_OPTION
    beginning = @datetime
    ending      = @datetime + option
    if today < beginning
      return 0
    elsif today <= ending
      rp = Sculd::Plan::REMINDER_PRIORITY
      dp = Sculd::Plan::DEADLINE_PRIORITY
      return (rp + (dp - rp) * (today - beginning)/(option.to_f)).to_i
    else
      return Sculd::Plan::DEADLINE_PRIORITY
    end
  end

  def event_dates
    #@option ||= DEFAULT_OPTION

    results = []
    results << @datetime
    results << @datetime + (@option || DEFAULT_OPTION)
    results.map do |datetime|
      Date.new(datetime.year, datetime.month, datetime.day)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sculd-0.2.2 lib/sculd/plan/todo.rb
sculd-0.2.1 lib/sculd/plan/todo.rb
sculd-0.2.0 lib/sculd/plan/todo.rb