Skip to content

Commit

Permalink
chore: do not return successful message if analytics failed
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumm committed May 21, 2024
1 parent 3a8e5e7 commit 6823796
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions analytics/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,54 @@ def run_script():


results = {}
failed_reason = None

try:
update_read_model()
except Exception as e:
logger.error("Script update_read_model failed", {"error": e})
failed_reason = "update_read_model"

if failed_reason:
logger.flush()
return {"error": failed_reason}

try:
results["traffic"] = calc_traffic()
except Exception as e:
logger.error("Script calc_traffic failed", {"error": e})
failed_reason = "calc_traffic"

try:
results["votes"] = calc_votes()
except Exception as e:
logger.error("Script calc_votes failed", {"error": e})
failed_reason = "calc_votes"

try:
results["behaviour"] = calc_behaviour()
except Exception as e:
logger.error("Script calc_behaviour failed", {"error": e})
failed_reason = "calc_behaviour"

try:
results["historical"] = calc_historical()
except Exception as e:
logger.error("Script calc_historical failed", {"error": e})
failed_reason = "calc_historical"

try:
results["location_and_user_agent"] = calc_location_and_user_agent()
except Exception as e:
logger.error("Script calc_location_and_user_agent failed", {"error": e})
failed_reason = "calc_location_and_user_agent"

duration = r(time.time() - start_time)

if failed_reason:
logger.flush()
return {"error": failed_reason, "duration": duration}

data_size_in_gb = r(sum(
os.path.getsize(f"./data/{f}") for f in os.listdir("./data") if os.path.isfile(f"./data/{f}")) / 1024 / 1024)
logs_size_in_gb = r(sum(
Expand Down
4 changes: 2 additions & 2 deletions src/pages/analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const Analytics = () => {
</Title>
<Text className="mb-4">
Free Planning Poker has decided to share all collected analytical
data publicly. This aims to provide interested parties with
<b>statistical insights into the Fibonacci-based Planning Poker</b>
data publicly. This aims to provide interested parties with{' '}
<b>statistical insights into the Fibonacci-based Planning Poker</b>{' '}
process. By examining the votes and averages of estimations (lowest,
average, highest), users can gain valuable psychological insights
into team dynamics and estimation behaviors, which can be
Expand Down

0 comments on commit 6823796

Please sign in to comment.