|
|
@@ -263,10 +263,13 @@ def fulfill_reward(db, reward_id): # Mark a reward as fulfilled in the database
|
|
|
def all_active_votes(db): # Get only active votes
|
|
|
votes = all_votes(db)
|
|
|
all_active_votes = []
|
|
|
- for name, count, info in votes:
|
|
|
- if is_reward_active(name):
|
|
|
- all_active_votes.append((name, count, info))
|
|
|
- return all_active_votes
|
|
|
+ try:
|
|
|
+ for name, count, info in votes:
|
|
|
+ if is_reward_active(name):
|
|
|
+ all_active_votes.append((name, count, info))
|
|
|
+ return all_active_votes
|
|
|
+ except Exception as aaverror:
|
|
|
+ current_app.logger.error(f'General exception: {aaverror}')
|
|
|
|
|
|
|
|
|
def all_goals(db): # Get all the goals
|
|
|
@@ -275,17 +278,20 @@ def all_goals(db): # Get all the goals
|
|
|
"SELECT name, progress, target, info FROM goals"
|
|
|
)
|
|
|
return cursor.fetchall()
|
|
|
- except Error as agerror:
|
|
|
+ except Exception as agerror:
|
|
|
current_app.logger.error(f'Couldn\'t select all goals: {agerror.args[0]}')
|
|
|
|
|
|
|
|
|
def all_active_goals(db): # Get only active goals
|
|
|
goals = all_goals(db)
|
|
|
all_active_goals = []
|
|
|
- for name, progress, target, info in goals:
|
|
|
- if is_reward_active(name):
|
|
|
- all_active_goals.append((name, progress, target, info))
|
|
|
- return all_active_goals
|
|
|
+ try:
|
|
|
+ for name, progress, target, info in goals:
|
|
|
+ if is_reward_active(name):
|
|
|
+ all_active_goals.append((name, progress, target, info))
|
|
|
+ return all_active_goals
|
|
|
+ except Exception as aagerror:
|
|
|
+ current_app.logger.error(f'General exception: {aagerror}')
|
|
|
|
|
|
|
|
|
def all_active_rewards(): # Get only active rewards
|