Skip to content

Commit

Permalink
Merge pull request #49 from YetAnotherTimeTracker/t-33-task-category-…
Browse files Browse the repository at this point in the history
…selection

T 33 task category selection
  • Loading branch information
avbelyaev authored Dec 18, 2017
2 parents c17d0fc + 58cf921 commit a44000e
Show file tree
Hide file tree
Showing 24 changed files with 965 additions and 488 deletions.
8 changes: 6 additions & 2 deletions components/automata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
from models.user import User
from utils import db_utils


CONTEXT_TASK = 'context_task'
CONTEXT_COMMANDS = 'context_commands'
CONTEXT_LANG = 'context_lang'
CONTEXT_ACTION = 'context_action'


class Automata:
def __init__(self):
Expand Down Expand Up @@ -55,7 +58,8 @@ def get_context(self, chat_id_value):
# TODO keep whole view history (linked hash set deque-like)
CONTEXT_TASK: None,
CONTEXT_COMMANDS: deque(maxlen=10),
CONTEXT_LANG: Language.ENG
CONTEXT_LANG: Language.ENG,
CONTEXT_ACTION: deque(maxlen=10)
}
return self.user_to_context[chat_id]

Expand All @@ -70,4 +74,4 @@ def if_can_transit_to(curr_state, command, new_state):
def get_transition(curr_state, command):
# curr_state and command should instances of classes from above
new_state_id = TRANSITION_TABLE[curr_state.value][command.value]
return State(new_state_id)
return State(new_state_id)
Loading

0 comments on commit a44000e

Please sign in to comment.