'python flask TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

I am getting this error. I use flask with sqlalchemy and flask login

function:

def getCoins(id):
    userr = User.query.get_or_404(id)

    if current_user.adViewStatus == 'done' or current_user.adViewStatus == 'none' or current_user.adViewStatus == 'nope':
        return redirect('/coins')
    elif current_user.adViewStatus == 'watching':
        current_user.points = current_user.points + 25
        current_user.adViewStatus = 'doneBoy'
        db.session.commit()
        return redirect('/youGotTheCoins')
    else:
        return redirect('/')

view function:

@application.route('/coins/get_more/view_ad/<int:id>', methods=['POST', 'GET'])
@login_required
def getCoins1(id):
    return getCoins(id)

db model

class User(UserMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String)
    password = db.Column(db.String)
    email = db.Column(db.String, unique=True)
    connection_type = db.Column(db.String)
    school = db.Column(db.String)
    real_name = db.Column(db.String)
    points = db.Column(db.Integer)
    adViewStatus = db.Column(db.String)
    viewer = db.Column(db.Integer)

I need a fast answer! Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source