hensei-api/app/blueprints/api/v1/gw_event_blueprint.rb
Justin Edmund f2a058b6b2 add GW events and scoring system
- create gw_events, crew_gw_participations, gw_crew_scores, gw_individual_scores
- add models, blueprints, controllers for GW tracking
- add model specs and gw_events controller specs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 23:34:54 -08:00

25 lines
627 B
Ruby

# frozen_string_literal: true
module Api
module V1
class GwEventBlueprint < ApiBlueprint
fields :name, :element, :start_date, :end_date, :event_number
field :status do |event|
if event.active?
'active'
elsif event.upcoming?
'upcoming'
else
'finished'
end
end
view :with_participation do
field :participation, if: ->(_fn, _obj, options) { options[:participation].present? } do |_, options|
CrewGwParticipationBlueprint.render_as_hash(options[:participation], view: :summary)
end
end
end
end
end