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

Сделал метод place_bet для betclub2 #87

Merged
merged 5 commits into from
Oct 4, 2016

Conversation

universome
Copy link
Owner

Close #19

@loyd
Copy link
Collaborator

loyd commented Oct 3, 2016

feat(base/session)
Ибо указывается модуль

let event = state.events.iter().find(|e| e.Id == offer.inner_id as u32).unwrap();
let market = event.get_market().unwrap();

let basket = if outcome.0 == event.TeamsGroup[0] {&market.Rates[0].AddToBasket}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пробелы после {

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как это можно на match переписать?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event.TeamsGroup[..] не константа, так что никак

}}"#,
event_id = basket.eId,
bet_id = basket.bId,
hand_size = match basket.fs { Some(v) => v.to_string(), _ => "null".to_string() },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А &v не сработало что ли?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope

return Err(Error::from(format!("Could not place a bet: {}", string)));
}

Ok(())
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У тебя short polling, так что ещё реализовать check_offer нужно

try!(response.read_to_string(&mut string));

if !string.contains("AmountIn") {
return Err(Error::from(format!("Could not place a bet: {}", string)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут префикс could not place... Лишний, это задача вызывающей функции

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А ещё я думаю, что лучше From::from вместо Error::from, ибо испортить не надо и гибче. Это вопрос стиля, так что давай определимся

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Но и у Error::from преимущества. Как думаешь?

@universome
Copy link
Owner Author

universome commented Oct 4, 2016

@loyd, обновил

@loyd loyd merged commit 0f98c25 into master Oct 4, 2016
@loyd loyd deleted the feature/19-betclub2-placebet branch October 4, 2016 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants