Permalink
Browse files

Changes in compliance with code review

  • Loading branch information...
fho
fho committed Dec 18, 2018
1 parent d4ab0ba commit e22fbb4a2dc57bcd94ff28e3786fe4186e46ec8f
@@ -45,7 +45,6 @@ osm-base-csi-value {
.hint {
.hint-container {
cursor: help;
//z-index: 10;
position: relative;
}
.csi-value-description {
@@ -135,8 +135,7 @@ class JobGroupController {
return
}

jobGroup.resultGraphiteServers.clear()
jobGroup.jobHealthGraphiteServers.clear()
clearGraphite()
if (params.version) {
def version = params.version.toLong()
if (jobGroup.version > version) {
@@ -156,8 +155,7 @@ class JobGroupController {
}


jobGroup.resultGraphiteServers.clear()
jobGroup.jobHealthGraphiteServers.clear()
clearGraphite()
params.list('resultGraphiteServers').each {
jobGroup.resultGraphiteServers.add(GraphiteServer.findById(it))
}
@@ -179,6 +177,11 @@ class JobGroupController {
redirect(action: "show", id: jobGroup.id)
}

def clearGraphite() {
jobGroup.resultGraphiteServers.clear()
jobGroup.jobHealthGraphiteServers.clear()
}

/**
* List tags starting with term.
*/
@@ -240,12 +240,18 @@ class MetricReportingService {
activity.done()
}

private Set<JobGroup> findCSIGroups() {
return jobGroupService.findCSIGroups().findAll {
it.resultGraphiteServers?.any {
server -> server.reportCsiAggregationsToGraphiteServer
}
}
}

private void reportPageCSIValues(Integer intervalInMinutes, DateTime reportingTimeStamp, BatchActivityUpdater activity) {
log.debug("reporting page csi-values with intervalInMinutes ${intervalInMinutes} for reportingTimestamp: ${reportingTimeStamp}")

def groups = jobGroupService.findCSIGroups().findAll {
it.resultGraphiteServers.size() > 0 && it.resultGraphiteServers.any { server -> server.reportCsiAggregationsToGraphiteServer }
}
def groups = findCSIGroups()
int size = groups.size()
activity.beginNewStage("Report page CSI Values", size)
groups.eachWithIndex { JobGroup eachJobGroup, int index ->
@@ -317,9 +323,7 @@ class MetricReportingService {

private void reportShopCSICsiAggregations(Integer intervalInMinutes, DateTime reportingTimeStamp, BatchActivityUpdater activity) {
log.debug("reporting shop csi-values with intervalInMinutes ${intervalInMinutes} for reportingTimestamp: ${reportingTimeStamp}")
def groups = jobGroupService.findCSIGroups().findAll {
it.resultGraphiteServers.size() > 0 && it.resultGraphiteServers.any { server -> server.reportCsiAggregationsToGraphiteServer }
}
def groups = findCSIGroups()
int size = groups.size()
activity.beginNewStage("Report CSI-Values", size)
groups.eachWithIndex { JobGroup currentJobGroup, int index ->
@@ -64,18 +64,18 @@ class PersistingResultsWithCsiIntegrationSpec extends NonTransactionalIntegratio

void "EventResults of all steps will be saved if some have a customer satisfaction while others have not."() {
Job.withNewSession {
given: ""
given: "Get WPT results with 5 steps and build job result"
createTestDataCommonToAllTests()
File file = new File("src/test/resources/WptResultXmls/MULTISTEP_1Run_5Steps.xml")
WptResultXml xmlResult = new WptResultXml(new XmlSlurper().parse(file))
JobResult.build(job: job, expectedSteps: 5, jobConfigRuns: 1, firstViewOnly: true,
testId: xmlResult.testId, jobResultStatus: JobResultStatus.RUNNING)

when: ""
when: "Job result gets persisted"
jobResultPersisterService.handleWptResult(xmlResult, xmlResult.testId, job)
List<EventResult> eventResults = EventResult.list()

then: ""
then: "All 5 event results are saved, only 3 have customer satisfaction"
JobResult.list().size() == 1
eventResults.size() == 5
eventResults.findAll { it.csByWptDocCompleteInPercent }.size() == 3

0 comments on commit e22fbb4

Please sign in to comment.