Models

class evesrp.models.AutoID

Mixin adding a primary key integer column named ‘id’.

class evesrp.models.Timestamped

Mixin adding a timestamp column.

The timestamp defaults to the current time.

class evesrp.models.Action(request, user, note=None, type_=None)[source]

Bases: flask_sqlalchemy.Model, evesrp.util.models.AutoID, evesrp.util.models.Timestamped, evesrp.util.models.AutoName

Actions change the state of a Request.

With the exception of the comment action (which does nothing), actions change the state of a Request.

note

Any additional notes for this action.

request

The Request this action applies to.

type_

The action be taken. See ActionType for possible values.

user

The User who made this action.

class evesrp.models.Modifier(request, user, note, value)[source]

Bases: flask_sqlalchemy.Model, evesrp.util.models.AutoID, evesrp.util.models.Timestamped, evesrp.util.models.AutoName

Modifiers apply bonuses or penalties to Requests.

This is an abstract base class for the pair of concrete implementations. Modifiers can be voided at a later date. The user who voided a modifier and when they did are recorded.

note

Any notes explaining this modification.

request

The Request this modifier applies to.

user

The User who added this modifier.

void(user)[source]

Mark this modifier as void.

Parameters:user (User) – The user voiding this modifier
voided_timestamp

If this modifier has been voided, this will be the timestamp of when it was voided.

voided_user

The User who voided this modifier if it has been voided.

class evesrp.models.Request(submitter, details, division, killmail, **kwargs)[source]

Bases: flask_sqlalchemy.Model, evesrp.util.models.AutoID, evesrp.util.models.Timestamped, evesrp.util.models.AutoName

Requests represent SRP requests.

__init__(submitter, details, division, killmail, **kwargs)[source]

Create a Request.

Parameters:
  • submitter (User) – The user submitting this request
  • details (str) – Supporting details for this request
  • division (Division) – The division this request is being submitted to
  • killmail (Killmail) – The killmail this request pertains to
actions

A list of Actions that have been applied to this request, sorted in the order they were applied.

alliance

The alliance of the pilot at the time of the killmail.

base_payout

The base payout for this request in millions of ISK. modifiers apply to this value.

constellation

The constellation this loss occured in.

corporation

The corporation of the pilot at the time of the killmail.

details

Supporting information for the request.

division

The Division this request was submitted to.

kill_timestamp

The date and time of when the ship was destroyed.

killmail_url

The URL of the source killmail.

modifiers

A list of all Modifiers that have been applied to this request, regardless of wether they have been voided or not. They’re sorted in the order they were added.

payout[source]

The resulting payout taking all active modifiers into account.

The return value is an internal class that will return different representations depending on the type it is being coerced to. Strings will be formatted accroding to the current locale with thousands separators, float()s will be in millions of ISK, and ints()s will be the total ISK value (equivalent to the string representation).

pilot

The Pilot for the killmail this request is for.

region

The region this loss occured in.

ship_type

The type of ship that was destroyed.

status

The current status of this request

submitter

The User who submitted this request.

system

The solar system this loss occured in.

transformed[source]

Get a special HTML representation of an attribute.

Divisions can have a transformer defined on a for attributes that output a URL associated with that attribute. This property provides easy access to the output of any transformed attributes on this request.

update_status_from_action(attr, action)[source]

Updates status whenever a new Action is added and verifies permissions.

valid_actions(user)[source]

Get valid actions (besides comment) the given user can perform.

validate_payout(attr, value)[source]

Ensures that base_payout is positive. The value is clamped to 0.

validate_status(attr, new_status)[source]

Enforces that status changes follow the status state diagram below. When an invalid change is attempted, ActionError is raised.

digraph request_workflow {
rankdir="LR";

sub [label="submitted", shape=plaintext];

node [style="dashed, filled"];

eval [label="evaluating", fillcolor="#fcf8e3"];
rej [label="rejected", style="solid, filled", fillcolor="#f2dede"];
app [label="approved", fillcolor="#d9edf7"];
inc [label="incomplete", fillcolor="#f2dede"];
paid [label="paid", style="solid, filled", fillcolor="#dff0d8"];

sub -> eval;
eval -> rej [label="R"];
eval -> app [label="R"];
eval -> inc [label="R"];
rej -> eval [label="R"];
inc -> eval [label="R, S"];
inc -> rej [label="R"];
app -> paid [label="P"];
app -> eval [label="R"];
paid -> eval [label="P"];
paid -> app [label="P"];
}

R means a reviewer can make that change, S means the submitter can make that change, and P means payers can make that change. Solid borders are terminal states.

Previous topic

Views

Next topic

Javascript

This Page