40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/wiq/commands/paid_sessions.rb', line 40
def list
params = { "per_page" => 50 }
params[:type] = options[:type] if options[:type]
params["location_id"] = options[:location] if options[:location]
records, total = fetch_index("/api/v1/paid_sessions", params, key: "paid_sessions")
if options[:season]
year = Integer(options[:season])
y_start = "#{year}-01-01"
y_end = "#{year}-12-31"
records = records.select do |ps|
(ps["start_at"].to_s <= y_end) && ((ps["end_at"].to_s >= y_start) || ps["end_at"].nil?)
end
end
render_index(
records, total: total,
summary: "Listed #{records.size} paid sessions#{options[:season] ? " for #{options[:season]}" : ""}.",
breadcrumbs: [
{ "cmd" => "wiq paid_sessions show <id>", "description" => "Inspect one session" },
{ "cmd" => "wiq reports run PaidSessionAccountingReport --paid-session <id>",
"description" => "Line-item accounting (admin only)" }
]
)
end
|