Sha256: 2d9ad99e729d08b39ec84c9d8ef3452e998152c6ab6d40d011af9cd13c5541fd

Contents?: true

Size: 652 Bytes

Versions: 2

Compression:

Stored size: 652 Bytes

Contents

class BatchActivitiesController < ApplicationController
  def new
    # Allow callers specifying defaults
    @date = params[:date] || Date.today

    # TODO: only employees currently working for tenant
    people = current_tenant.company.employees

    @activities = people.map{|person|
      person.activities.build(:project => person.latest_project)
    }
  end

  def create
    date = Date.parse(params[:batch_activities][:date])
    @activites = params[:activities].collect{|activity_params|
      Activity.create(activity_params.merge(:date => date, :minutes => "0"))
    }

    redirect_to activities_path(:by_date => date.to_s(:db))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bookyt_projects-0.12.0 app/controllers/batch_activities_controller.rb
bookyt_projects-0.11.2 app/controllers/batch_activities_controller.rb