Skip to content

Commit b7252ae

Browse files
ddamkeddamke
authored andcommitted
simplified logic
1 parent 214fed8 commit b7252ae

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/main/java/de/doubleslash/keeptime/view/ProjectReport.java

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ProjectReport {
2828
/** The slf4j-logger for this class. */
2929
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
3030

31-
private int numberOfNotes;
31+
private int numberOfNotEmptyNotes;
3232

3333
private final int size;
3434

@@ -40,27 +40,19 @@ public ProjectReport(final int size) {
4040
}
4141

4242
public void appendToWorkNotes(final String currentWorkNote) {
43-
this.numberOfNotes++;
44-
this.sb.append(currentWorkNote.trim());
4543
if (!currentWorkNote.isEmpty()) {
46-
if (this.size>1) {
44+
this.numberOfNotEmptyNotes++;
45+
if (this.numberOfNotEmptyNotes >1) {
4746
this.sb.append(NOTE_DELIMETER);
4847
}
48+
this.sb.append(currentWorkNote.trim());
4949
} else {
5050
LOG.debug("Skipping empty note.");
5151
}
52-
53-
if(numberOfNotes==this.size){
54-
int lastSemiColonIndex = this.sb.lastIndexOf(";");
55-
if (lastSemiColonIndex != -1) {
56-
this.sb.deleteCharAt(lastSemiColonIndex);
57-
this.sb.setLength(this.sb.length()-1); //Removes a blank space at the end
58-
}
59-
}
6052
}
6153

62-
public int getNumberOfNotes() {
63-
return this.numberOfNotes;
54+
public int getNumberOfNotEmptyNotes() {
55+
return this.numberOfNotEmptyNotes;
6456
}
6557

6658
public String getNotes() {

0 commit comments

Comments
 (0)