forked from Kamva-Academy/Kamva-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate roadmap from PlayerHistory to PlayerTransition
- Loading branch information
1 parent
21cc38f
commit b50f868
Showing
3 changed files
with
40 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
from django.db import models | ||
|
||
from apps.fsm.models import State | ||
from apps.fsm.models import PlayerTransition, State | ||
|
||
|
||
# todo: refactor: Link model should be replaced with PlayerTransiton model | ||
class Link: | ||
source: str | ||
target: str | ||
|
||
def __init__(self, source, target): | ||
def __init__(self, source: State, target: State): | ||
self.source = source | ||
self.target = target | ||
|
||
@staticmethod | ||
def get_link_from_states(source: State, target: State): | ||
return Link(source.name, target.name) | ||
def get_link_from_states(source_state: State, taret_state: State): | ||
return Link(source_state.name, taret_state.name) | ||
|
||
@staticmethod | ||
def get_link_from_transition(player_transition: PlayerTransition): | ||
return Link.get_link_from_states(player_transition.source_state, player_transition.target_state) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters