28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/wiq/commands/rosters.rb', line 28
def list
params = { "per_page" => 100 }
unless options[:archived].nil?
params["q[archived_eq]"] = options[:archived]
end
records, total = fetch_index("/api/v1/rosters", params, key: "rosters")
if options[:season]
resolver = Wiq::SeasonResolver.new(client)
ids = resolver.paid_session_ids_for(options[:season])
raise Wiq::SeasonNotFoundError, options[:season] if ids.empty?
records = resolver.filter_rosters_by_ids(records, ids)
end
if options[:season_tag]
tag = options[:season_tag]
records = records.select do |r|
(r["taggings"] || []).any? { |t| t.dig("tag", "name") == tag }
end
end
render_index(
records, total: total,
summary: "Listed #{records.size} rosters.",
breadcrumbs: [
{ "cmd" => "wiq rosters show <id>", "description" => "Inspect a single roster" },
{ "cmd" => "wiq reports run RosterReport --roster <id>",
"description" => "Export the roster as a report" }
]
)
end
|