community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1864363 - in /comdev/reporter.apache.org/trunk/site/wizard/js: source/generators.js wizard.js
Date Sun, 04 Aug 2019 07:11:35 GMT
Author: humbedooh
Date: Sun Aug  4 07:11:35 2019
New Revision: 1864363

URL: http://svn.apache.org/viewvc?rev=1864363&view=rev
Log:
Rework release listing, so we sort by newest first and simplify the logic when fewer than
3 new releases.

Modified:
    comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js
    comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js?rev=1864363&r1=1864362&r2=1864363&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js Sun Aug  4 07:11:35
2019
@@ -316,14 +316,17 @@ function activity_tips(data) {
         ages.push(reldate.unix());
     }
     ages.sort().reverse();
-    ages = ages.splice(0,3);
+    ages = ages.splice(0,new_releases >= 3 ? new_releases : 3);
     let releases_shown = 0;
-    for (var rel in data.releases[project]) {
-        let reldate = moment(data.releases[project][rel] * 1000.0);
-        if (reldate > three_months_ago || (new_releases < 3 && releases_shown
< 3 && ages.has(reldate.unix()))) {
-            rtxt += "<li>%s was released on %s.</li>".format(rel, reldate.format('YYYY-MM-DD'));
-            releases_shown++;
-        }
+    while (ages.length) {
+      let ts = ages.shift();
+      for (var rel in data.releases[project]) {
+          let reldate = moment(data.releases[project][rel] * 1000.0);
+          if (ts == reldate.unix()) {
+              rtxt += "<li>%s was released on %s.</li>".format(rel, reldate.format('YYYY-MM-DD'));
+              releases_shown++;
+          }
+      }
     }
     if (rtxt != '') {
         rtxt = "<h6>Recent releases: </h6><ul>" + rtxt + "</ul><hr/>";

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js?rev=1864363&r1=1864362&r2=1864363&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js Sun Aug  4 07:11:35 2019
@@ -1488,14 +1488,17 @@ function activity_tips(data) {
         ages.push(reldate.unix());
     }
     ages.sort().reverse();
-    ages = ages.splice(0,3);
+    ages = ages.splice(0,new_releases >= 3 ? new_releases : 3);
     let releases_shown = 0;
-    for (var rel in data.releases[project]) {
-        let reldate = moment(data.releases[project][rel] * 1000.0);
-        if (reldate > three_months_ago || (new_releases < 3 && releases_shown
< 3 && ages.has(reldate.unix()))) {
-            rtxt += "<li>%s was released on %s.</li>".format(rel, reldate.format('YYYY-MM-DD'));
-            releases_shown++;
-        }
+    while (ages.length) {
+      let ts = ages.shift();
+      for (var rel in data.releases[project]) {
+          let reldate = moment(data.releases[project][rel] * 1000.0);
+          if (ts == reldate.unix()) {
+              rtxt += "<li>%s was released on %s.</li>".format(rel, reldate.format('YYYY-MM-DD'));
+              releases_shown++;
+          }
+      }
     }
     if (rtxt != '') {
         rtxt = "<h6>Recent releases: </h6><ul>" + rtxt + "</ul><hr/>";



Mime
View raw message