<%! from calefaction.format import ( format_quantity, format_isk_compact, format_utctime_compact, format_security, get_security_class) %> <%def name="_killboard_kill(kill, detail, any_alliances, any_factions)"> <% victim = kill["victim"] system = g.eve.universe.system(kill["system"]) killed = g.eve.universe.killable(victim["ship_id"]) %> ${format_utctime_compact(kill["date"]) | h}
${format_isk_compact(kill["value"]) | h} ${system.name | h} ${format_security(system.security)}
${system.region.name | h} Kill ${kill['id']}: ${killed.name | h} ${victim['char_name'] | h} % if detail: ${victim['char_name'] | h} (${killed.name | h}) % endif ${victim['corp_name'] | h} % if any_alliances: % if victim["alliance_id"]: ${victim['alliance_name'] | h} % endif % endif % if any_factions: % if victim["faction_id"]: ${victim['faction_name'] | h} % endif % endif % if not detail and (any_alliances or any_factions) and not victim["alliance_id"] and not victim["faction_id"]: % endif % if detail: % endif <%def name="_itemboard_item(item)"> <% type_id, count, value = item type = g.eve.universe.type(type_id) %> ${type.name | h} ${format_quantity(count) | h}
${format_isk_compact(value) | h} <%def name="_build_sort_changer(keys, descriptors, sortby)"> % if keys: % endif <%def name="_killboard_recent(summary, detail, sortby)"> % if detail: <% descriptors = { "new": "most recent first", "old": "most recent last", "value": "most valuable first" } if sortby not in descriptors: sortby = "new" %>

Kills:

${_build_sort_changer(["new", "old", "value"], descriptors, sortby)} % else:
Most recent kills:
% endif <% any_alliances = any(kill["victim"]["alliance_id"] for kill in summary) any_factions = any(kill["victim"]["faction_id"] for kill in summary) %>
% for kill in summary: ${_killboard_kill(kill, detail, any_alliances, any_factions)} % endfor
<%def name="_collection_items(summary, detail, sortby)"> % if detail: <% descriptors = { "value": "most valuable first", "quantity": "greatest quantity first", "price": "most expensive first" } if sortby not in descriptors: sortby = "value" %>

Items:

${_build_sort_changer(["value", "quantity", "price"], descriptors, sortby)} % else:
Top items:
% endif
% for item in summary: ${_itemboard_item(item)} % endfor
<%def name="render_summary(renderer, summary, detail=False, sortby=None)"><% if renderer == "killboard_recent": return _killboard_recent(summary, detail, sortby) if renderer == "collection_items": return _collection_items(summary, detail, sortby) raise RuntimeError("Unknown renderer: %s" % renderer) %>