* Explicitly close ResultSet in DatabaseUpdate process to prevent not being able to update the Database due to it being locked. Closes #6.

* Don't create backup of non-existing database if we're creating a fresh one.
* Changed the style of HTML exports slightly.
This commit is contained in:
Fabian Schlenz 2016-07-26 21:20:42 +02:00
parent fad822d53d
commit eb9715cb09
3 changed files with 26 additions and 8 deletions

View File

@ -54,8 +54,8 @@ public class DatabaseUpdates {
rs = stmt.executeQuery("SELECT MAX(version) FROM database_versions");
rs.next();
version = rs.getInt(1);
rs.close();
}
rs.close();
logger.debug("version: {}", version);
System.out.println("Database version: " + version);
logger.debug("Max available database version is {}", getMaxPossibleVersion());
@ -70,8 +70,12 @@ public class DatabaseUpdates {
}
}
if (backup) {
logger.debug("Performing backup");
db.backupDatabase(version);
if (version > 0) {
logger.debug("Performing backup");
db.backupDatabase(version);
} else {
logger.debug("NOT performing a backup, because we are creating a fresh database and don't need a backup of that.");
}
}
logger.debug("Applying updates");

View File

@ -95,6 +95,7 @@ public class HTMLExporter {
for (Database.Dialog d : dialogs) {
LinkedList<HashMap<String, Object>> messages = db.getMessagesForExport(d);
scope.clear();
scope.put("user", user);
scope.put("dialog", d);
scope.put("messages", messages);
@ -112,9 +113,11 @@ public class HTMLExporter {
for (Database.Chat c : chats) {
LinkedList<HashMap<String, Object>> messages = db.getMessagesForExport(c);
scope.clear();
scope.put("user", user);
scope.put("chat", c);
scope.put("messages", messages);
scope.putAll(db.getMessageAuthorsWithCount(c));
scope.put("heatmap_data", intArrayToString(db.getMessageTimesMatrix(c)));
scope.putAll(db.getMessageTypesWithCount(c));
scope.putAll(db.getMessageMediaTypesWithCount(c));

View File

@ -98,6 +98,15 @@
{name: 'Others', y: {{authors.count.others}}, drilldown: 'Others'},
]
}],
plotOptions: {
pie: {
dataLabels: {
style: {
width: '150px',
},
},
},
},
drilldown: {
series: [{
name: 'Authors',
@ -152,9 +161,11 @@
});
</script>
<span id="heatmap" style="width: 400px; height: 500px;"></span>
<span id="heatmap" style="width: 500px; height: 600px;"></span>
{{#count.dialogs}}<span id="chart_chat_types" style="width: 400px; height: 500px;"></span>{{/count.dialogs}}
<span id="chart_message_types" style="width: 400px; height: 500px;"></span>
<span id="chart_media_types" style="width: 400px; height: 500px;"></span>
<span id="chart_authors" style="width: 400px; height: 500px;"></span>
{{#count.dialogs}}
<span id="chart_chat_types" style="width: 600px; height: 500px;"></span>
{{/count.dialogs}}
<span id="chart_message_types" style="width: 600px; height: 500px;"></span>
<span id="chart_media_types" style="width: 600px; height: 500px;"></span>
<span id="chart_authors" style="width: 600px; height: 500px;"></span>