sort cryps

This commit is contained in:
ntr 2019-01-05 16:51:25 +11:00
parent f359332cf4
commit 1e4f2ccc80
3 changed files with 5 additions and 3 deletions

View File

@ -134,7 +134,7 @@ const CustomPipeline = new Phaser.Class({
Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline.call(this, {
game,
renderer: game.renderer,
fragShader: PLASMA,
fragShader: STARS,
});
},
});

View File

@ -189,8 +189,9 @@ pub fn account_cryps(tx: &mut Transaction, account: &Account) -> Result<Vec<Cryp
return Err(err_msg("could not deserialize a cryp"));
}
// now unwrap is safe
return Ok(cryps.unwrap());
let mut cryps = cryps.unwrap();
cryps.sort_by_key(|c| c.id);
return Ok(cryps);
}
pub fn account_game_history(tx: &mut Transaction, account: &Account) -> Result<Vec<Game>, Error> {

View File

@ -160,6 +160,7 @@ impl Game {
let index = team.cryps.iter().position(|t| t.id == cryp.id).unwrap();
team.cryps.remove(index);
team.cryps.push(cryp.clone());
team.cryps.sort_unstable_by_key(|c| c.id);
},
None => panic!("cryp not in game"),
};