Class: MOCO::WorkTimeAdjustment

Inherits:
BaseEntity show all
Defined in:
lib/moco/entities/work_time_adjustment.rb

Overview

Represents a MOCO user work time adjustment record (Korrekturen Zeiterfassung) for overtime/undertime corrections

Required attributes for create:

user_id     - Integer, user to adjust
date        - String, "YYYY-MM-DD" effective date
description - String, reason for adjustment
hours       - Float, hours to add (positive) or subtract (negative)

Read-only attributes:

id, user (Hash), creator (Hash), created_at, updated_at

Example:

# Add overtime from previous year
moco.work_time_adjustments.create(
  user_id: 123,
  date: "2024-01-01",
  description: "Overtime carryover from 2023",
  hours: 42.0
)

# Correct time balance
moco.work_time_adjustments.create(
  user_id: 123,
  date: "2024-06-15",
  description: "Correction for unpaid leave",
  hours: -16.0
)

Filtering:

moco.work_time_adjustments.where(user_id: 123)
moco.work_time_adjustments.where(from: "2024-01-01", to: "2024-12-31")

Instance Attribute Summary

Attributes inherited from BaseEntity

#attributes, #client

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseEntity

#==, #association, #destroy, #eql?, #has_many, #hash, #id, #initialize, #inspect, #reload, #save, #to_h, #to_json, #update

Constructor Details

This class inherits a constructor from MOCO::BaseEntity

Class Method Details

.entity_pathObject



38
39
40
# File 'lib/moco/entities/work_time_adjustment.rb', line 38

def self.entity_path
  "users/work_time_adjustments"
end

Instance Method Details

#to_sObject



47
48
49
# File 'lib/moco/entities/work_time_adjustment.rb', line 47

def to_s
  "WorkTimeAdjustment ##{id} (#{date})"
end

#userObject

Associations



43
44
45
# File 'lib/moco/entities/work_time_adjustment.rb', line 43

def user
  association(:user)
end