Models¶
- class evesrp.models.ActionType[source]¶
An Enum for representing the types of Actions performed on a Request in addition to the status of a Request.
- statuses[source]¶
A frozenset of all of the single ActionType members that also double as statuses for Requests.
- finalized[source]¶
A frozenset of the ActionTypes that are terminal states for a Request (paid and rejected).
- pending[source]¶
A frozenset of ActionTypes for Requests that require further action to be put in a finalized state.
- approved = <approved>¶
Status for a request that has been evaluated and is awaitng payment.
- evaluating = <evaluating>¶
Status for a request being evaluated.
- incomplete = <incomplete>¶
Status for a request that is missing details and needs further action.
- paid = <paid>¶
Status for a request that has been paid. This is a terminatint state.
- rejected = <rejected>¶
Status for a requests that has been rejected. This is a terminating state.
- 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.
Requests enforce permissions when actions are added to them. If the user adding the action does not have the appropriate Permissions in the request’s Division, an ActionError will be raised.
With the exception of the comment action (which just adds text to a request), actions change the status of a Request.
- note¶
Any additional notes for this action.
- type_¶
The action be taken. See ActionType for possible values.
- class evesrp.models.ModifierError[source]¶
Error raised when a modification is attempted to a Request when it’s in an invalid state.
- 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 it was voided are recorded.
Requests enforce permissions when modifiers are added. If the user adding a modifier does not have the appropriate Permissions in the request’s Division, a ModifierError will be raised.
- voided[source]¶
Boolean of whether this modifier has been voided or not.
This property is available as a hybrid_property, so it can be used natively in SQLAlchemy queries.
- note¶
Any notes explaining this modification.
- 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.
- class evesrp.models.AbsoluteModifier(request, user, note, value)[source]¶
Subclass of Modifier for representing absolute modifications.
Absolute modifications are those that are not dependent on the value of Request.base_payout.
- value¶
How much ISK to add or remove from the payout
- class evesrp.models.RelativeModifier(request, user, note, value)[source]¶
Subclass of Modifier for representing relative modifiers.
Relative modifiers depend on the value of Modifier.base_payout to calculate their effect.
- value¶
What percentage of the payout to add or remove
- 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.
- payout¶
The total payout of this request taking all active modifiers into account.
In calculating the total payout, all absolute modifiers along with the base_payout are summed. This is then multipled by the sum of all of the relative modifiers plus 1. This property is a read-only hybrid_property, so it can be used natively in SQLAlchemy queries.
Boolean of if this request is in a finalized state. Also a read-only hybrid_property so it can be used natively in SQLAlchemy queries.
- actions¶
A list of Actions that have been applied to this request, sorted in the order they were applied.
- base_payout¶
The base payout for this request.
This value is clamped to a lower limit of 0. It can only be changed when this request is in an evaluating state, or else a ModifierError will be raised.
- constellation¶
The constellation this loss occured in.
- details¶
Supporting information for the request.
- 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
The payout for this requests taking into account all active modifiers.
- region¶
The region this loss occured in.
- ship_type¶
The type of ship that was destroyed.
- status¶
This attribute is automatically kept in sync as Actions are added to the request. It should not be set otherwise.
At the time an Action is added to this request, the type of action is checked and the state diagram below is enforced. If the action is invalid, an ActionError is raised.
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.
- system¶
The solar system this loss occured in.