Very strange error with data update (MySQL)
I'm not sure, if you could put this into a failing test-case that demonstrated a bug in Peewee then I would be happy to look into it. As it is, this type of question is more appropriate for stackoverflow or the peewee mailing list. http://docs.peewee-orm.com/en/latest/peewee/contributing.html#questions
Good afternoon, I encountered a very strange mistake. I need to add bonuses to my users every day. To do this, I get a list of users who have the opportunity to receive a bonus and in the cycle update their bonus fields in the database. I do it atomically. And it happens, so some fields are updated from one user and others are not, for example, gaming money for some increases and others do not, and in the database it is written that a person received a bonus. Very strange, one user object, some data is updated, the other is not. I used to use Sqlite before and everything worked fine until I had a lot of users.

Please can u help me, i dont undastand where is mistake :(( Why one field in row changed but other not.


    PEOPLE_PER_PAGE = 100
    all_count_users = User.select(fn.Count(User.id)).where((User.balance > 0.0) & (User.daily_profit == False)).scalar()
    pages = math.ceil(all_count_users / PEOPLE_PER_PAGE)
    for i in range(0, pages):
        users = User.select().where((User.balance > 0.0) & (User.daily_profit == False)).paginate(i + 1, PEOPLE_PER_PAGE)
        for user in users:
            with database.atomic():
                current_percentage = percentage
                if user.referral_individual != None and user.referral_individual > 0:
                    current_percentage = user.referral_individual
                profit = round(formula(user.balance, current_percentage), 2)
                user.residue = round(user.residue + profit, 2)
                user.total_profit = round(user.total_profit + profit, 2)
                user.daily_profit = True
                user.save()

All the daily_profit field is updated perfectly, but not all the residue field changes. I just do not eat anything like that at all! Operation is atomic.