mirror of
https://github.com/rickbarrette/redmine_qbo_calendar.git
synced 2026-11-17 21:50:37 -05:00
Calendar review fixes; working day hours setting
- Issues' estimated hours are spread over their working days from start to due date, instead of counted in full on both the start and due dates - Tooltips in the two rightmost columns open leftward again (the rule targeted the old table layout) - Today scrolls when today is on the page (the check read calendar values that don't exist) - "Day N of M" on calendar cards and My Page skips holidays; My Page uses the user's date - Each appointment's working days are worked out once per page (CustomerAppointment#working_days), and shared by placement, hours, day numbers and the end date - The calendar toggles are kept in the session, so changing month loads the page once - Clicking inside an open tooltip keeps it open; estimates load with the appointments - Hours in a working day is a plugin setting (default 8) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ae522baf63
commit
3a5d83aa69
12 files changed
+148
-187
No files matched your search
@@ -73,10 +73,22 @@ class CustomerAppointment < ActiveRecord::Base
|
||||
# Last working day of the appointment. Weekends and holidays are skipped, matching how the
|
||||
# calendar spreads a multi-day appointment (a 3-day job starting Friday ends Tuesday).
|
||||
def due_date
|
||||
return nil unless date
|
||||
@due_date_cache ||= {}
|
||||
@due_date_cache[[start_date, duration.to_i]] ||=
|
||||
RedmineQboCalendar::WorkingDays.nth_working_day(start_date, duration)
|
||||
working_days.last
|
||||
end
|
||||
|
||||
# The working days the appointment takes (weekends and holidays skipped), in order: "Day 2 of 3" is the
|
||||
# second. Pass the holidays when working this out for many appointments, to read them once.
|
||||
def working_days(holidays: nil)
|
||||
return [] unless date
|
||||
@working_days ||= {}
|
||||
@working_days[[start_date, duration.to_i]] ||=
|
||||
RedmineQboCalendar::WorkingDays.dates(start_date, duration, **{ holidays: holidays }.compact)
|
||||
end
|
||||
|
||||
# Which working day of the appointment a date is (1 for the first), or nil when it isn't one
|
||||
def working_day_number(day)
|
||||
index = working_days.index(day.to_date)
|
||||
index && index + 1
|
||||
end
|
||||
|
||||
# Appointments the user may see. Requires the global "View customer appointments" permission.
|
||||
|
||||
Reference in new issue
Block a user