int totalMicroEditsBefore = 0;
int totalMicroEditsAfter = 0;
int totalRevisionsBefore = 0;
int totalRevisionsAfter = 0;
result.append("<table border=1>\n");
Repository repository = collabReview.getRepository();
TreeSet<String> articles = new TreeSet<String>();
for (ArtifactIdentifier artifactIdentifier : repository.listAllArtifacts()) {
articles.add(artifactIdentifier.getName());
/*articles.add("GreenIT");
articles.add("Hydra_JF");
articles.add("Reputationforge");
articles.add("Issues");
articles.add("Enocean");
articles.add("Projekt_BRIDGE");
articles.add("Zeitschriften-Wunschliste");*/
}
for (String article : articles) {
logger.debug("Computing micro edits for article " + article);
Artifact artifact = repository.getLatestForName(article, "");
int beforeCount = MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, microEditCastigatorInstallTime, surveyPeriod);
int afterCount = MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, microEditCastigatorInstallTime + surveyPeriod, surveyPeriod);
totalMicroEditsBefore += beforeCount;
totalMicroEditsAfter += afterCount;
result.append(String.format("<tr><td>%s</td><td>%d</td><td>%d</td>", article, beforeCount, afterCount));
for (int i = 0; i < 2 * slices; i++) {
int microEditCount = MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, microEditCastigatorInstallTime + surveyPeriod - i * surveyPeriod / slices, surveyPeriod / slices);
microEditCounts[i] += microEditCount;
result.append("<td>").append(microEditCount).append("</td>");
}
result.append("</tr>\n");
repository.commit();
}
result.append(String.format("<tr><td>Total</td><td>%d</td><td>%d</td>", totalMicroEditsBefore, totalMicroEditsAfter));
for (int i = 0; i < 2 * slices; i++) {
result.append("<td>").append(microEditCounts[i]).append("</td>");
}
result.append("</tr>\n");
logger.debug("Counting revisions...");
for (ArtifactIdentifier artifactIdentifier : repository.listAllArtifacts()) {
long time = repository.getArtifact(artifactIdentifier).getDate().getTime();
if (time > microEditCastigatorInstallTime - surveyPeriod && time < microEditCastigatorInstallTime) {
totalRevisionsBefore++;
}
if (time > microEditCastigatorInstallTime && time < microEditCastigatorInstallTime + surveyPeriod) {
totalRevisionsAfter++;
}
repository.commit();
}
result.append(String.format("<tr><td>Total revisions</td><td>%d</td><td>%d</td></tr>\n", totalRevisionsBefore, totalRevisionsAfter));
result.append("</table>\n");
logger.debug("done");
}