Skip to content

Commit

Permalink
fix: autosens logs to be evaluated line by line
Browse files Browse the repository at this point in the history
  • Loading branch information
mkellerman committed Jul 12, 2024
1 parent 14f0b4a commit dd38115
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions FreeAPS/Sources/APS/OpenAPS/JavaScriptWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ final class JavaScriptWorker {
if outputLogs.isEmpty { return }

if logContext == "prepare/autosens.js" {
outputLogs = outputLogs.replacingOccurrences(
of: "((?:[\\=\\+\\-]\\n)+)?\\d+h\\n((?:[\\=\\+\\-]\\n)+)?",
with: "",
options: .regularExpression
)
outputLogs = outputLogs.split(separator: "\n").map { logLine in
logLine.replacingOccurrences(
of: "^[-+=]|\\d{1,2}h$",
with: "",
options: .regularExpression
)
}.joined(separator: "\n")
}

if !outputLogs.isEmpty {
Expand Down

0 comments on commit dd38115

Please sign in to comment.