Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/343766 )

Change subject: Monthly Phabricator stats email: Fix output for zero open UBN! 
tasks
......................................................................


Monthly Phabricator stats email: Fix output for zero open UBN! tasks

Bug: T159314
Change-Id: I53f9092733d12a6f00640a2e2255011bf8f8d925
---
M modules/phabricator/templates/community_metrics.sh.erb
1 file changed, 8 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/modules/phabricator/templates/community_metrics.sh.erb 
b/modules/phabricator/templates/community_metrics.sh.erb
index c684dc8..abcfaf7 100644
--- a/modules/phabricator/templates/community_metrics.sh.erb
+++ b/modules/phabricator/templates/community_metrics.sh.erb
@@ -149,10 +149,16 @@
 tasksopen=$(echo $result_tasksopen | cut -d " " -f3)
 
 epochnow=$(date +%s)
+# regex if we have zero open tasks (can happen for unbreaknow; see T159314):
+regex='^[0-9]+$'
 
 mediantasksopen_unbreaknow_epoch=$(echo $result_mediantasksopen_unbreaknow | 
cut -d " " -f3 | sed 's/.0000//' | sed 's/.5000//')
-diff_unbreaknow=$((epochnow-mediantasksopen_unbreaknow_epoch))
-mediantasksopen_unbreaknow=$(echo $((diff_unbreaknow/86400)))
+if [[ $mediantasksopen_unbreaknow_epoch =~ $regex ]] ; then
+  diff_unbreaknow=$((epochnow-mediantasksopen_unbreaknow_epoch))
+  mediantasksopen_unbreaknow=$(echo $((diff_unbreaknow/86400)))
+else
+  mediantasksopen_unbreaknow=0
+fi
 
 mediantasksopen_needstriage_epoch=$(echo $result_mediantasksopen_needstriage | 
cut -d " " -f3 | sed 's/.0000//' | sed 's/.5000//')
 diff_needstriage=$((epochnow-mediantasksopen_needstriage_epoch))

-- 
To view, visit https://gerrit.wikimedia.org/r/343766
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I53f9092733d12a6f00640a2e2255011bf8f8d925
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Aklapper <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to