Пример #1
0
 def update_user_by_password(old, new):
     Database.update_record(
         document="users",
         new_record={"password": old},
         new_query={"$set": {
             "password": User.encode_password(new)
         }})
Пример #2
0
 def update_amount(name):
     currencylist, pos = Source.get_currency()
     gamer = Gamer.get_gamer_by_name(name)
     ans = 0
     for currency in gamer["gameCurrency"]:
         temp = convert(currency, "AUD", gamer["gameCurrency"][currency], currencylist, pos)
         ans += temp
     ans = float(round(ans, 2))
     Database.update_record(document="game", new_record={"name": name},
                            new_query={"$set": {"amount": ans}})
     return ans
Пример #3
0
 def update_gameCurrency(name, from_currency, to_currency, from_amount):
     currencylist, pos = Source.get_currency()
     to_amount = convert(from_currency, to_currency, from_amount, currencylist, pos)
     temp_gameCurrency = Gamer.get_gamer_by_name(name)["gameCurrency"]
     temp_gameCurrency[from_currency] = float(temp_gameCurrency[from_currency]) - float(from_amount)
     temp_gameCurrency[to_currency] = float(temp_gameCurrency[to_currency]) + float(to_amount)
     temp_gameCurrency[from_currency] = float(round(temp_gameCurrency[from_currency], 2))
     temp_gameCurrency[to_currency] = float(round(temp_gameCurrency[to_currency], 2))
     if temp_gameCurrency[from_currency] < 0:
         return 0
     Database.update_record(document="game", new_record={"name": name},
                            new_query={"$set": {"gameCurrency": temp_gameCurrency}})
     print(Gamer.get_gamer_by_name(name)["gameCurrency"])
     Gamer.update_amount(name)
     return 1
Пример #4
0
 def update_user_by_email(old, new):
     Database.update_record(document="users",
                            new_record={"email": old},
                            new_query={"$set": {
                                "email": new
                            }})
Пример #5
0
 def update_reminder(email, currency, price):
     Database.update_record(document="all_alert", new_record={"email":email, "currency": currency}, new_query={"$set": {"price": price}})