Fix improperly set favorite_card_evolve

This commit is contained in:
Ethan O'Brien 2024-04-29 20:48:17 -05:00
parent 05ed74f3c6
commit 51a82a5161
2 changed files with 2 additions and 1 deletions

View file

@ -330,7 +330,7 @@ pub fn give_exp(amount: i32, user: &mut JsonValue) {
}
}
fn get_card(id: i64, user: &JsonValue) -> JsonValue {
pub fn get_card(id: i64, user: &JsonValue) -> JsonValue {
if id == 0 {
return object!{};
}

View file

@ -153,6 +153,7 @@ pub fn user_post(req: HttpRequest, body: String) -> HttpResponse {
}
if !body["favorite_master_card_id"].is_null() {
user["user"]["favorite_master_card_id"] = body["favorite_master_card_id"].clone();
user["user"]["favorite_card_evolve"] = if global::get_card(body["favorite_master_card_id"].as_i64().unwrap(), &user)["evolve"].is_empty() { 0 } else { 1 }.into();
}
if !body["guest_smile_master_card_id"].is_null() {
user["user"]["guest_smile_master_card_id"] = body["guest_smile_master_card_id"].clone();