src/main/java/de/uapcore/lightpit/entities/IssueSummary.java

Mon, 01 Jun 2020 14:46:58 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 01 Jun 2020 14:46:58 +0200
changeset 86
0a658e53177c
child 116
d24354f21df5
permissions
-rw-r--r--

improves issue overview and adds progress information

     1 package de.uapcore.lightpit.entities;
     3 public class IssueSummary {
     4     private int open = 0;
     5     private int active = 0;
     6     private int done = 0;
     8     public int getOpen() {
     9         return open;
    10     }
    12     public void setOpen(int open) {
    13         this.open = open;
    14     }
    16     public int getActive() {
    17         return active;
    18     }
    20     public void setActive(int active) {
    21         this.active = active;
    22     }
    24     public int getDone() {
    25         return done;
    26     }
    28     public void setDone(int done) {
    29         this.done = done;
    30     }
    32     public int getTotal() {
    33         return open+active+done;
    34     }
    36     public int getOpenPercent() {
    37         return 100-getActivePercent()-getDonePercent();
    38     }
    40     public int getActivePercent() {
    41         int total = getTotal();
    42         return total > 0 ? 100*active/total : 0;
    43     }
    45     public int getDonePercent() {
    46         int total = getTotal();
    47         return total > 0 ? 100*done/total : 0;
    48     }
    50     /**
    51      * Adds the specified issue to the summary by increming the respective counter.
    52      * @param issue the issue
    53      */
    54     public void add(Issue issue) {
    55         switch (issue.getStatus().getPhase()) {
    56             case 0:
    57                 open++;
    58                 break;
    59             case 1:
    60                 active++;
    61                 break;
    62             case 2:
    63                 done++;
    64                 break;
    65         }
    66     }
    67 }

mercurial