]> WPIA git - gigi.git/commitdiff
Highlight expired nucleus bonus verifications in points overview
authorINOPIAE <m.maengel@inopiae.de>
Wed, 8 Feb 2017 15:18:54 +0000 (16:18 +0100)
committerINOPIAE <m.maengel@inopiae.de>
Wed, 8 Feb 2017 20:13:02 +0000 (21:13 +0100)
fixes issue #123

Change-Id: I796e0e2f81897c35307fcdc64255127f058696a2

src/org/cacert/gigi/dbObjects/Assurance.java
src/org/cacert/gigi/dbObjects/User.java
src/org/cacert/gigi/output/AssurancesDisplay.java
src/org/cacert/gigi/output/AssurancesDisplay.templ

index 33dbf1ed5e26fcfbcf593214906b3332467aff7f..07c3a39be3b721fc10287181aa591087e408a86b 100644 (file)
@@ -1,5 +1,7 @@
 package org.cacert.gigi.dbObjects;
 
+import java.util.Date;
+
 import org.cacert.gigi.database.DBEnum;
 import org.cacert.gigi.dbObjects.wrappers.DataContainer;
 
@@ -41,7 +43,9 @@ public class Assurance {
 
     private Country country;
 
-    public Assurance(int id, User from, Name to, String location, String method, int points, String date, Country country) {
+    private Date expireDate;
+
+    public Assurance(int id, User from, Name to, String location, String method, int points, String date, Country country, Date expireDate) {
         this.id = id;
         this.from = from;
         this.to = to;
@@ -50,7 +54,7 @@ public class Assurance {
         this.points = points;
         this.date = date;
         this.country = country;
-
+        this.expireDate = expireDate;
     }
 
     public User getFrom() {
@@ -84,4 +88,19 @@ public class Assurance {
     public Country getCountry() {
         return country;
     }
+
+    public Date getExpireDate() {
+        return expireDate;
+    }
+
+    public boolean isExpired() {
+        boolean expired = false;
+        if (expireDate == null) {
+            expired = false;
+        } else {
+            Date now = new Date();
+            expired = expireDate.before(now);
+        }
+        return expired;
+    }
 }
index fa02012ad1edf942d3cac5ea2790993f8568e2c2..ad2d38675c64329da0eef5d6c2e16974c8e1c061 100644 (file)
@@ -617,7 +617,7 @@ public class User extends CertificateOwner {
 
     private Assurance assuranceByRes(GigiResultSet res) {
         try {
-            return new Assurance(res.getInt("id"), User.getById(res.getInt("from")), Name.getById(res.getInt("to")), res.getString("location"), res.getString("method"), res.getInt("points"), res.getString("date"), res.getString("country") == null ? null : Country.getCountryByCode(res.getString("country"), CountryCodeType.CODE_2_CHARS));
+            return new Assurance(res.getInt("id"), User.getById(res.getInt("from")), Name.getById(res.getInt("to")), res.getString("location"), res.getString("method"), res.getInt("points"), res.getString("date"), res.getString("country") == null ? null : Country.getCountryByCode(res.getString("country"), CountryCodeType.CODE_2_CHARS), res.getTimestamp("expire"));
         } catch (GigiApiException e) {
             throw new Error(e);
         }
index 356a0349be3b9c75f3be157a8282dd69fde01d04..86034158e64a55cb0fee246d9f4e967d331a47b2 100644 (file)
@@ -31,9 +31,11 @@ public class AssurancesDisplay implements Outputable {
         final Assurance[] assurances = (Assurance[]) vars.get(assuranceArray);
         if (assurer) {
             vars.put("verb", l.getTranslation("To (User Id)"));
+            vars.put("info", "");
         } else {
             vars.put("verb", l.getTranslation("From"));
             vars.put("myName", "yes");
+            vars.put("info", l.getTranslation("Coloured rows show expired nucleus bonus verifications which are not counted to the total of verification points."));
         }
 
         IterableDataset assuranceGroup = new IterableDataset() {
@@ -62,6 +64,7 @@ public class AssurancesDisplay implements Outputable {
                     vars.put("date", assurance.getDate());
                     vars.put("location", assurance.getLocation() + " (" + (assurance.getCountry() == null ? l.getTranslation("not given") : assurance.getCountry().getName()) + ")");
                     vars.put("points", assurance.getPoints());
+                    vars.put("expired", assurance.isExpired());
                     i++;
                     return true;
                 }
index b7c0e4fce9f16db73b042e452a190834076511fb..41f9fd871e0bfb7290eedb8613da8ccf1fbc1293 100644 (file)
@@ -12,7 +12,7 @@
 <td><?=_Method?></td>
 </tr>
 <? foreach($assurances) {?>
-<tr>
+<tr <? if($expired) { ?> class="info" <? } ?> >
 <? if($support) { ?>
 <td><a href="/support/user/<?=$linkId?>/"><?=$id?></a></td>
 <? } else { ?>
@@ -28,4 +28,5 @@
 <td><?=$method?></td>
 </tr>
 <? } ?>
-</table>
\ No newline at end of file
+</table>
+<?=$info?>
\ No newline at end of file