Skip to content

Commit 93275c6

Browse files
committed
bugfix-manager dashboard search issues and metrics search issue
1 parent fc85965 commit 93275c6

File tree

6 files changed

+50
-20
lines changed

6 files changed

+50
-20
lines changed

WebContent/WEB-INF/jsp/metrics/lineChartDataJson.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<s:if test="#astat.index != 0">,</s:if>{ "start" : "<s:date name="start" format="yyyy-MM-dd"/>",
4444
"end" : "<s:date name="completed" format="yyyy-MM-dd" />",
4545
"appid" : "${a.appId}",
46-
"name" : "<s:property value="name"/>",
46+
"name" : "<s:property value="name.trim()"/>",
4747
"cname" : "<s:property value="campaign.name"/>",
4848
"users" : "<s:iterator value="assessor" status="ustat"><s:if test="#ustat.index != 0">, </s:if><s:property value="fname"/> <s:property value="lname"/></s:iterator>",
4949
"report" : "<s:if test="#a.finalReport != null"><a href='DownloadReport?guid=${a.finalReport.filename}'>Report</a></s:if>",

pom.xml.releaseBackup

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>org.faction</groupId>
44
<artifactId>faction</artifactId>
5-
<version>1.7.1-SNAPSHOT</version>
5+
<version>1.7.4-SNAPSHOT</version>
66
<packaging>war</packaging>
77
<name>Faction</name>
88
<scm>
@@ -51,6 +51,13 @@
5151
<artifactId>maven-compiler-plugin</artifactId>
5252
<version>3.10.1</version>
5353
<configuration>
54+
<annotationProcessorPaths>
55+
<path>
56+
<groupId>org.projectlombok</groupId>
57+
<artifactId>lombok</artifactId>
58+
<version>1.18.36</version>
59+
</path>
60+
</annotationProcessorPaths>
5461
<source>8</source>
5562
<target>8</target>
5663
</configuration>

release.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#release configuration
2-
#Mon Nov 24 22:54:12 CST 2025
2+
#Sun Mar 01 14:46:33 CST 2026
33
projectVersionPolicyId=default
44
scm.branchCommitComment=@{prefix} prepare branch @{releaseLabel}
55
project.scm.org.faction\:faction.tag=1.7.0
66
pinExternals=false
77
projectVersionPolicyConfig=<projectVersionPolicyConfig>${projectVersionPolicyConfig}</projectVersionPolicyConfig>\n
88
exec.activateProfiles=github
99
pushChanges=true
10-
project.dev.org.faction\:faction=1.7.2-SNAPSHOT
11-
project.rel.org.faction\:faction=1.7.1
10+
project.dev.org.faction\:faction=1.7.5-SNAPSHOT
11+
project.rel.org.faction\:faction=1.7.4
1212
scm.rollbackCommitComment=@{prefix} rollback the release of @{releaseLabel}
1313
remoteTagging=true
1414
scm.commentPrefix=[maven-release-plugin]
@@ -20,7 +20,7 @@ scm.developmentCommitComment=@{prefix} prepare for next development iteration
2020
scm.id=faction-web
2121
exec.additionalArguments=-Dmaven.javadoc.skip\=true -Dmaven.test.skipTests\=true -Dmaven.test.skip\=true
2222
scm.tagNameFormat=@{project.version}
23-
scm.tag=1.7.1
23+
scm.tag=1.7.4
2424
exec.snapshotReleasePluginAllowed=false
2525
project.scm.org.faction\:faction.url=https\://github.com/factionsecurity/faction.git
2626
preparationGoals=clean verify

src/com/fuse/actions/Metrics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ private void plotAssessment(List<Assessment> asmts, List<RiskLevel> levels, bool
425425
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
426426
Date chartDate = a.getCompleted() == null ? a.getEnd() : a.getCompleted();
427427
if (isCamp) {
428-
dates += ", [\"" + sdf.format(chartDate) + "\",\"" + a.getAppId() + "\",\" " + a.getName() + "\"]";
428+
dates += ", [\"" + sdf.format(chartDate) + "\",\"" + a.getAppId() + "\",\" " + a.getName().trim() + "\"]";
429429
} else {
430430
dates += ", \"" + sdf.format(chartDate) + "\"";
431431
}

src/com/fuse/actions/dashboard/ManagerDashboard.java

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ private void calculateFilteredStatistics() {
319319
}
320320

321321
// For completed assessments, count by assessor
322-
if ( ("Completed".equals(status) || status == null && assessment.getCompleted() != null || status == "Open" && assessment.getCompleted() != null) && assessment.getAssessor() != null) {
322+
if ( (("Complete".equals(status) || "Completed".equals(status)) || status == null && assessment.getCompleted() != null || status == "Open" && assessment.getCompleted() != null) && assessment.getAssessor() != null) {
323323
for (User assessor : assessment.getAssessor()) {
324324
String assessorName = assessor.getFname() + " " + assessor.getLname();
325325
filteredAssessorStats.put(assessorName,
@@ -364,6 +364,8 @@ private void calculateFilteredStatistics() {
364364

365365
private void performAssessmentSearch() {
366366
List<Assessment> results;
367+
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
368+
StringBuilder query = new StringBuilder("{");
367369

368370
// If not searching, get current month's assessments
369371
if (!"search".equals(searchAction)) {
@@ -374,33 +376,46 @@ private void performAssessmentSearch() {
374376
cal.set(Calendar.MINUTE, 0);
375377
cal.set(Calendar.SECOND, 0);
376378
cal.set(Calendar.MILLISECOND, 0);
377-
Date monthStart = cal.getTime();
379+
startDate = cal.getTime();
378380

379381
cal.add(Calendar.MONTH, 1);
380382
cal.add(Calendar.DAY_OF_MONTH, -1);
381383
cal.set(Calendar.HOUR_OF_DAY, 23);
382384
cal.set(Calendar.MINUTE, 59);
383385
cal.set(Calendar.SECOND, 59);
384-
Date monthEnd = cal.getTime();
386+
endDate = cal.getTime();
387+
385388

386389
// Query assessments for current month
387-
results = em.createQuery("from Assessment where start >= :monthStart and start <= :monthEnd order by start desc", Assessment.class)
388-
.setParameter("monthStart", monthStart)
389-
.setParameter("monthEnd", monthEnd)
390-
.getResultList();
390+
query.append("$and: [");
391+
query.append(" { \"start\": {$lte: ISODate(\"").append(sdf.format(endDate)).append("\")}}, ");
392+
query.append(" { $or: [ ");
393+
query.append(" { \"completed\": { $exists: true, $gte: ISODate(\"")
394+
.append(sdf.format(startDate)).append("\")}}");
395+
query.append(" ,");
396+
query.append(" { \"completed\": {$exists: false}},");
397+
query.append(" ]}");
398+
query.append("]}");
399+
results = em.createNativeQuery(query.toString(), Assessment.class).getResultList();
391400
searchResults = results;
392401
return;
393402
}
394403

395404
// Build MongoDB query for search mode
396-
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
397-
StringBuilder query = new StringBuilder("{");
398405
boolean hasConditions = false;
399406

400407
// Build date range condition
401408
if (startDate != null && endDate != null) {
402-
query.append("\"start\": {$lte: ISODate(\"").append(sdf.format(endDate)).append("\")}, ");
403-
query.append("\"end\": {$gte: ISODate(\"").append(sdf.format(startDate)).append("\")}");
409+
endDate.setDate(endDate.getDate()+1);
410+
query.append("$and: [");
411+
query.append(" { \"start\": {$lte: ISODate(\"").append(sdf.format(endDate)).append("\")}}, ");
412+
query.append(" { $or: [ ");
413+
query.append(" { \"completed\": { $exists: true, $gte: ISODate(\"")
414+
.append(sdf.format(startDate)).append("\")}}");
415+
query.append(" ,");
416+
query.append(" { \"completed\": {$exists: false}},");
417+
query.append(" ]}");
418+
query.append("]");
404419
hasConditions = true;
405420
}
406421

src/com/fuse/actions/dashboard/ManagerDashboardCSV.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,16 @@ private List<Assessment> performAssessmentSearch() {
192192
// Build date range condition - include assessments that overlap with the search
193193
// range
194194
if (startDate != null && endDate != null) {
195-
query.append("\"start\": {$lte: ISODate(\"").append(sdf.format(endDate)).append("\")}, ");
196-
query.append("\"end\": {$gte: ISODate(\"").append(sdf.format(startDate)).append("\")}");
195+
endDate.setDate(endDate.getDate()+1);
196+
query.append("$and: [");
197+
query.append(" { \"start\": {$lte: ISODate(\"").append(sdf.format(endDate)).append("\")}}, ");
198+
query.append(" { $or: [ ");
199+
query.append(" { \"completed\": { $exists: true, $gte: ISODate(\"")
200+
.append(sdf.format(startDate)).append("\")}}");
201+
query.append(" ,");
202+
query.append(" { \"completed\": {$exists: false}},");
203+
query.append(" ]}");
204+
query.append("]");
197205
hasConditions = true;
198206
}
199207

0 commit comments

Comments
 (0)