~jan0sch/smederee

Showing details for patch a53bf38dd04193223c38cd243c930eae473cad4f.
2025-03-28 (Fri), 5:59 PM - Jens Grassel - a53bf38dd04193223c38cd243c930eae473cad4f

statistics: Fix crash due to division by zero arithmetics.

Summary of changes
2 files modified with 5 lines added and 0 lines removed
  • modules/hub/src/main/resources/messages.properties with 1 added and 0 removed lines
  • modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryStatistics.scala.html with 4 added and 0 removed lines
diff -rN -u old-smederee/modules/hub/src/main/resources/messages.properties new-smederee/modules/hub/src/main/resources/messages.properties
--- old-smederee/modules/hub/src/main/resources/messages.properties	2025-04-01 04:12:57.980077602 +0000
+++ new-smederee/modules/hub/src/main/resources/messages.properties	2025-04-01 04:12:57.980077602 +0000
@@ -299,6 +299,7 @@
 repository.statistics.description=Some statistics on the repository. Details for programming languages are provided by tokei if available.
 repository.statistics.general-details=General details about the repository
 repository.statistics.latest-patch=Latest patch at
+repository.statistics.no-data=There is not enough data to calculate statistics.
 repository.statistics.number-of-patch-authors=Number of patch authors
 repository.statistics.number-of-patches=Number of patches
 repository.statistics.oldest-patch=Oldest patch at
diff -rN -u old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryStatistics.scala.html new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryStatistics.scala.html
--- old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryStatistics.scala.html	2025-04-01 04:12:57.980077602 +0000
+++ new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryStatistics.scala.html	2025-04-01 04:12:57.980077602 +0000
@@ -35,6 +35,7 @@
       <div class="pure-u-1 pure-u-lg-2-5">
         <div class="l-box">
           <h3>@Messages("repository.statistics.general-details")</h3>
+          @if(stats.numberOfPatches > 0) {
           <table class="pure-table pure-table-horizontal" style="text-align: left;">
             <tbody>
               <tr>
@@ -63,6 +64,9 @@
               </tr>
             </tbody>
           </table>
+          } else {
+            <p class="alert">@Messages("repository.statistics.no-data")</p>
+          }
         </div>
       </div>
       <div class="pure-u-1 pure-u-lg-3-5">