Sha256: def149b0a35220c217384bb62af2f7e4c66988d47114e7deb30b62496feb6d15

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

#!/usr/bin/env ruby -w
# encoding: UTF-8
#
# = Booking.rb -- The TaskJuggler III Project Management Software
#
# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011
#               by Chris Schlaeger <chris@linux.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#

class TaskJuggler

  class Booking

    attr_reader :resource, :task, :intervals
    attr_accessor :sourceFileInfo, :overtime, :sloppy

    def initialize(resource, task, intervals)
      @resource = resource
      @task = task
      @intervals = intervals
      @sourceFileInfo = nil
      @overtime = 0
      @sloppy = 0
    end

    def to_s
      out = "#{@resource.fullId} "
      first = true
      @intervals.each do |iv|
        if first
          first = false
        else
          out += ", "
        end
        out += "#{iv.start} + #{(iv.end - iv.start) / 3600}h"
      end
    end

    def to_tjp(taskMode)
      out = taskMode ? "#{@task.fullId} " : "#{@resource.fullId} "
      first = true
      @intervals.each do |iv|
        if first
          first = false
        else
          out += ",\n"
        end
        out += "#{iv.start} + #{(iv.end - iv.start) / 3600}h"
      end
      out += ' { overtime 2 }'
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
taskjuggler-3.0.0 lib/taskjuggler/Booking.rb
taskjuggler-0.2.2 lib/taskjuggler/Booking.rb
taskjuggler-0.2.1 lib/taskjuggler/Booking.rb
taskjuggler-0.2.0 lib/taskjuggler/Booking.rb