The select loop is processed twice
Are you using SQLite, and in the body of the for loop are you issuing any INSERT/UPDATE/DELETE queries? #450 touches on this, but essentially you should do one of the following:

* wrap the for loop in a transaction using `with db.atomic():`
* coerce the select query to a list before iterating over it.
I have a strange problem, the select loop is processed twice. Ie I receive from the database 2 objects, and the cycle passes 4 times.

    for enter in Enter.select().join(PaySystem).where(
                    (Enter.en_status == 1) &
                    (Enter.en_date >= startdate) &
                    (PaySystem.ps_abbr=='btc')):

I made a variable count and derived its value, it turned out 4. Why is it so?