Skip to content

Commit

Permalink
Ignore admin holds for other instrument coloring
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinco committed Feb 28, 2025
1 parent bf4d462 commit 0185a56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/presenters/calendar_events_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ def unavailable_events

def reservation_events
reservations.map do |reservation|
event_data = reservation.as_calendar_object(calendar_opts)

if params[:with_details] && reservation.product_id != instrument.id
event_data[:className] = "other-instrument"
end

event_data
reservation.as_calendar_object(calendar_opts)
end
end

Expand All @@ -66,6 +60,7 @@ def calendar_opts
start_at:,
end_at:,
with_details: params[:with_details],
instrument_id: instrument.id,
}
end

Expand Down
6 changes: 6 additions & 0 deletions app/presenters/reservations/calendar_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def as_calendar_object(options = {})

return ret if options[:with_details].blank?

if options[:with_details] && options[:instrument_id].present? && product_id != options[:instrument_id]
ret[:className] = "other-instrument"
end

ret.merge(
title: order.user.full_name,
email: order.user.email,
Expand All @@ -60,8 +64,10 @@ def as_calendar_object(_options = {})
if expires_mins_before.present?
hash[:expiration] = "Expires #{MinutesToTimeFormatter.new(expires_mins_before)} prior"
end

hash[:className] = "unavailable" if __getobj__.is_a?(AdminReservation)
end
end
end

end

0 comments on commit 0185a56

Please sign in to comment.