Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot offers time to book but it's busy #6

Open
pavelsr opened this issue Nov 20, 2016 · 2 comments
Open

Bot offers time to book but it's busy #6

pavelsr opened this issue Nov 20, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@pavelsr
Copy link
Member

pavelsr commented Nov 20, 2016

error

@denistex denistex added the bug label Nov 20, 2016
@denistex denistex self-assigned this Nov 20, 2016
@denistex denistex modified the milestone: 1.0-rc2 Nov 20, 2016
@denistex denistex modified the milestones: backlog, 1.0-rc2 Feb 8, 2017
@pavelsr
Copy link
Member Author

pavelsr commented Apr 30, 2017

Problem is that in UserFSM.pm INSTRUCTOR rule haven't called

DATETIME => {
				do => sub { $ctrl->do_datetime(@_); },
				rules => [
					INSTRUCTOR => sub { $ctrl->datetime_rule_instructor(@_); },

					DURATION => sub { $ctrl->datetime_rule_duration(@_); },
					CANCEL => sub { $ctrl->datetime_rule_cancel(@_); },

					DATETIME_FAILED => 1
				],
			},

Since in FSA::Rules rules are evaluated in order - problem is that $ctrl->datetime_rule_instructor(@_); doesn't return a true value

So need to analyse output of datetime_rule_instructor sub of UserFSMContoller.pm

sub datetime_rule_instructor {
	my ($self, $state, $update) = @_;
	FSMUtils::_with_text($update, sub {  # preform callback on update text
		FSMUtils::_parse_value($state, sub {
			$self->{dtf}->parse(shift);
		}, shift);
	});
}

FSMUtils::_with_text returns a result of callback function under update message text or undef

UPD: In this case we datetime_rule_instructor returns true value and FSM goes by INSTRUCTOR -> INSTRUCTOR_NOT_FOUND states instead of INSTRUCTOR -> BOOK

@pavelsr
Copy link
Member Author

pavelsr commented May 3, 2017

Well, seems like I figured it out.
There is no correction on timeZone in instructor_rule_book method: when I select time in Telegram May 5 10:00 am in bot log I see 2017-05-05T07:00:00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants