little fixes
This commit is contained in:
@@ -164,13 +164,13 @@ impl<'q> AsPlayer<'q> {
|
|||||||
.first::<models::Wealth>(self.conn)?;
|
.first::<models::Wealth>(self.conn)?;
|
||||||
// TODO: improve this
|
// TODO: improve this
|
||||||
// should be move inside a WealthUpdate method
|
// should be move inside a WealthUpdate method
|
||||||
let update = models::Wealth::from_gp(current_wealth.to_gp() + value_in_gp);
|
let updated_wealth = models::Wealth::from_gp(current_wealth.to_gp() + value_in_gp);
|
||||||
// Difference in coins that is sent back
|
// Difference in coins that is sent back
|
||||||
let (old, new) = (current_wealth.as_tuple(), update.as_tuple());
|
let (old, new) = (current_wealth.as_tuple(), updated_wealth.as_tuple());
|
||||||
let diff = (new.0 - old.0, new.1 - old.1, new.2 - old.2, new.3 - old.3);
|
let diff = (new.0 - old.0, new.1 - old.1, new.2 - old.2, new.3 - old.3);
|
||||||
diesel::update(players)
|
diesel::update(players)
|
||||||
.filter(id.eq(self.id))
|
.filter(id.eq(self.id))
|
||||||
.set(&update)
|
.set(&updated_wealth)
|
||||||
.execute(self.conn)
|
.execute(self.conn)
|
||||||
.map(|r| match r {
|
.map(|r| match r {
|
||||||
1 => ActionStatus {
|
1 => ActionStatus {
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ fn main() {
|
|||||||
// Server is started with 'serve' subcommand
|
// Server is started with 'serve' subcommand
|
||||||
// $ lootalot serve
|
// $ lootalot serve
|
||||||
// Start the server.
|
// Start the server.
|
||||||
server::serve();
|
server::serve().ok();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user