Skip to content

Commit

Permalink
2.52.1 Log uploader prevents second submission, properly detects dupl…
Browse files Browse the repository at this point in the history
…icate records, stats corrected, displays Comment in parse results
  • Loading branch information
classaxe committed Aug 27, 2022
1 parent 52fa2bb commit 1548caa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
5 changes: 4 additions & 1 deletion public/js/functions.js
@@ -1,7 +1,7 @@
/*
* Project: RXX - NDB Logging Database
* Homepage: https://rxx.classaxe.com
* Version: 2.52.0
* Version: 2.52.1
* Date: 2022-08-27
* Licence: LGPL
* Copyright: 2022 Martin Francis
Expand Down Expand Up @@ -1796,7 +1796,10 @@ function initListenersLogUploadForm() {
e.preventDefault();
return false;
}
$('#form_back').attr('disabled', 'disabled');
$('#form_submitLog').attr('disabled', 'disabled');
$('#form_step').val(3);
$('#form form').submit();
});

$('#copyDetails').on('click', function() {
Expand Down
4 changes: 2 additions & 2 deletions public/js/functions.min.js

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions src/Controller/Web/Listeners/ListenerLogsUpload.php
Expand Up @@ -178,6 +178,7 @@ public function controller(
'_locale' => $_locale,
'mode' => $title,
'cle' => $this->cleRepository->find(1),
'comment' => $this->comment,
'entries' => $this->entries,
'errors' => $this->errors,
'form' => $form->createView(),
Expand Down Expand Up @@ -288,15 +289,16 @@ private function processBatch($sessionID = false) {
foreach($entries as $e) {
$isPresent = false;
if ($row = $this->logRepository->findDuplicate($e['signalID'], $listenerID, $e['YYYYMMDD'], $e['time'])) {
if ($operatorId === $row['operatorID']) {
if ((int)$operatorId === (int)$row['operatorID']) {
$stats['duplicates']++;
} else {
$log = $this->logRepository->find($row['ID']);
$log->setLogSessionId($sessionID)
->setOperatorId($operatorId ? (int)$operatorId : null);
$this->getDoctrine()->getManager()->flush();
$stats['grouped']++;
$stats['logs']++;
continue;
}
$log = $this->logRepository->find($row['ID']);
$log->setLogSessionId($sessionID)
->setOperatorId($operatorId ? (int)$operatorId : null);
$this->getDoctrine()->getManager()->flush();
$stats['grouped']++;
$isPresent = true;
}
$stats['logs']++;
Expand Down Expand Up @@ -358,7 +360,7 @@ private function processBatch($sessionID = false) {
$logSession
->setFirstLog(DateTime::createFromFormat('Y-m-d H:i:s', $stats['first_log']) ?? null)
->setLastLog(DateTime::createFromFormat('Y-m-d H:i:s', $stats['last_log']) ?? null)
->setLogs($stats['logs'])
->setLogs($stats['logs'] - $stats['duplicates'])
->setLogsDgps($stats['logs_dgps'])
->setLogsDsc($stats['logs_dsc'])
->setLogsHambcn($stats['logs_hambcn'])
Expand Down
3 changes: 3 additions & 0 deletions src/js/logsuploader.js
Expand Up @@ -181,7 +181,10 @@ function initListenersLogUploadForm() {
e.preventDefault();
return false;
}
$('#form_back').attr('disabled', 'disabled');
$('#form_submitLog').attr('disabled', 'disabled');
$('#form_step').val(3);
$('#form form').submit();
});

$('#copyDetails').on('click', function() {
Expand Down
7 changes: 6 additions & 1 deletion templates/listener/logs_upload/parse.html.twig
@@ -1,5 +1,10 @@
{% if (entries) %}
{% if (multiOperator == 'Y') %}<p><strong>Operator:</strong> {{ operator.getFormattedNameAndLocation }}</p>{% endif %}
{% if (multiOperator == 'Y' or comment) %}
<div>
{% if (multiOperator == 'Y') %}<strong>Operator:</strong> {{ operator.getFormattedNameAndLocation }}{% endif %}
{% if comment %}<div class="float-right"><strong>Comment:</strong> {{ comment }}</div>{% endif %}
</p>
{% endif %}
<h2>
{% trans %}Review{% endtrans %} ({% trans with { '%COUNT%' : entries|length} %}%COUNT% Logs{% endtrans %})
<div class="check-links">{% trans %}Select{% endtrans %} [
Expand Down

0 comments on commit 1548caa

Please sign in to comment.