Performance verbessert und die Darstellung.. auch :P

This commit is contained in:
Daniel Schick 2023-01-11 15:33:42 +01:00
parent 6a11764fe2
commit 3cac798fae
5 changed files with 28 additions and 10 deletions

View File

@ -50,7 +50,7 @@
<value>60</value>
</setting>
<setting name="SQLiteDBConnectionString" serializeAs="String">
<value>Data Source=ais_initial.db;Version=3;</value>
<value>Data Source=ais_initial.db;Version=3;Synchronous=OFF;Journal Mode=MEMORY;</value>
</setting>
<setting name="PosReportDBCleanupDays" serializeAs="String">
<value>7</value>

View File

@ -12,7 +12,7 @@ namespace bsmd.AIS2Service.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -70,7 +70,7 @@ namespace bsmd.AIS2Service.Properties {
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=ais_initial.db;Version=3;")]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=ais_initial.db;Version=3;Synchronous=OFF;Journal Mode=MEMORY;")]
public string SQLiteDBConnectionString {
get {
return ((string)(this["SQLiteDBConnectionString"]));

View File

@ -18,7 +18,7 @@
<Value Profile="(Default)">60</Value>
</Setting>
<Setting Name="SQLiteDBConnectionString" Type="System.String" Scope="Application">
<Value Profile="(Default)">Data Source=ais_initial.db;Version=3;</Value>
<Value Profile="(Default)">Data Source=ais_initial.db;Version=3;Synchronous=OFF;Journal Mode=MEMORY;</Value>
</Setting>
<Setting Name="PosReportDBCleanupDays" Type="System.Int32" Scope="Application">
<Value Profile="(Default)">7</Value>

View File

@ -15,13 +15,21 @@ namespace bsmd.AIS2Service
if (!id.HasValue) return null;
List<ShipLocationReport> result = AISManager.SQLiteStorage.GetShipLocationReports(id.Value);
// remove results not in SitRep
int obscureTargetCnt = result.RemoveAll(x => !AISManager.SitRep.ContainsKey(x.MMSI));
_log.InfoFormat("removed {0} obscure targets", obscureTargetCnt);
// remove targets w/o name (i.e. static data)
int unnamedPlayerCnt = result.RemoveAll(x => string.IsNullOrEmpty(AISManager.SitRep[x.MMSI].Name));
_log.InfoFormat("removed {0} unnamed targets", unnamedPlayerCnt);
// Class B targets entfernen
int classBReportCnt = result.RemoveAll(x => AISManager.SitRep.ContainsKey(x.MMSI) && (AISManager.SitRep[x.MMSI].IsClassB ?? false));
_log.DebugFormat("removed {0} class B alarms from list"); // tut des?
int classBReportCnt = result.RemoveAll(x => AISManager.SitRep[x.MMSI].IsClassB ?? false);
_log.InfoFormat("removed {0} class B alarms from list", classBReportCnt); // tut des?
// auch alles entfernen was "abgelaufen" ist und nicht im SitRep enthalten ist
int expiredCnt = result.RemoveAll(x => AISManager.SitRep.ContainsKey(x.MMSI) && ((DateTime.Now - x.Timestamp_Last).TotalMinutes > 1440));
_log.InfoFormat("removed {0} expired (> 1 day) alarms from list");
int expiredCnt = result.RemoveAll(x => (DateTime.Now - x.Timestamp_Last).TotalMinutes > 1440);
_log.InfoFormat("removed {0} expired (> 1 day) alarms from list", expiredCnt);
Dictionary<int, List<ShipLocationReport>> mmsiDict = new Dictionary<int, List<ShipLocationReport>>();
foreach(ShipLocationReport report in result) {

View File

@ -59,7 +59,7 @@ function updateData(data, groupId) {
table.childNodes[1].appendChild(row); // append row to tbody subelement
}
row.setAttribute("isActive", "true");
const colCount = row.childNodes.length;
row.childNodes[0].innerHTML = data[i].Name;
if(data[i].VoyageDirection == 0) row.childNodes[1].innerHTML = '<img src="img/bullet_square_yellow.png" />';
@ -82,7 +82,15 @@ function updateData(data, groupId) {
row.childNodes[colCount - 1].innerHTML = data[i].Destination;
}
// TODO: remove rows (after an interval) that are not in the result set any more
// array in-place removal taking place
var i = table.childNodes[1].rows.length;
while (i--) {
row = table.childNodes[1].rows[i];
if(row["isActive"] !== "true") {
table.childNodes[1].rows.remove(row);
}
}
}
function update() {
@ -154,6 +162,8 @@ function createAreas()
th6.innerHTML='Destination';
tr.appendChild(th6);
tr.setAttribute("isActive", "true"); // set marker so it won't get deleted later
aTable.appendChild(document.createElement('tbody'));
aDiv.appendChild(aTable);
aDiv.appendChild(document.createElement('hr'));