Revert "don't start tutorial after registration"
This reverts commit bc0d00fd2be909a7ba50ee81b51115ed04f8e642.
This commit is contained in:
parent
62b8fa37a4
commit
5bac39d86c
@ -530,3 +530,24 @@ pub fn img_check(account: &Account) -> Result<Uuid, Error> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tutorial(tx: &mut Transaction, account: &Account) -> Result<Option<Instance>, Error> {
|
||||
let query = "
|
||||
SELECT count(id)
|
||||
FROM players
|
||||
WHERE account = $1;
|
||||
";
|
||||
|
||||
let result = tx
|
||||
.query(query, &[&account.id])?;
|
||||
|
||||
let row = result.iter().next()
|
||||
.ok_or(format_err!("unable to fetch joined games account={:?}", account))?;
|
||||
|
||||
let count: i64 = row.get(0);
|
||||
|
||||
if count == 0 {
|
||||
return Ok(Some(instance_practice(tx, account)?));
|
||||
}
|
||||
|
||||
return Ok(None);
|
||||
}
|
||||
@ -128,6 +128,10 @@ impl User for Authenticated {
|
||||
let wheel = account::chat_wheel(&db, a.id)?;
|
||||
self.ws.send(RpcMessage::ChatWheel(wheel))?;
|
||||
|
||||
if let Some(instance) = account::tutorial(&mut tx, &a)? {
|
||||
self.ws.send(RpcMessage::InstanceState(instance))?;
|
||||
}
|
||||
|
||||
// tx should do nothing
|
||||
tx.commit()?;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user