Sha256: 34e8994c169e35aafae4fb5a3787ff66d4c772e56d6003cd1191d5a7c15c5ad3
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
# Displays available cpd_cycles that the current_user may complete class EffectiveCpdAvailableCyclesDatatable < Effective::Datatable datatable do order :start_at col :start_at, visible: false col(:title, label: cpd_cycle_label) col :available_date col :target_score, label: "Required #{cpd_credits_label}" do |cpd_cycle| cpd_score(current_user.cpd_target_score(cpd_cycle: cpd_cycle)) end actions_col(actions: []) do |cpd_cycle| statement = current_user.cpd_statement(cpd_cycle: cpd_cycle) if statement.blank? dropdown_link_to('Start', effective_cpd.cpd_cycle_cpd_statement_build_path(cpd_cycle, :new, :start)) else dropdown_link_to('Continue', effective_cpd.cpd_cycle_cpd_statement_build_path(cpd_cycle, statement, statement.next_step)) end end end collection do raise('expected a current_user') unless current_user.present? completed = EffectiveCpd.CpdStatement.completed.where(user: current_user) Effective::CpdCycle.available.where.not(id: completed.select('cpd_cycle_id as id')) end end
Version data entries
3 entries across 3 versions & 1 rubygems