diff --git a/csharp/App/Backend/Mailer/Mailer.cs b/csharp/App/Backend/Mailer/Mailer.cs index 096d5a549..a04097e06 100644 --- a/csharp/App/Backend/Mailer/Mailer.cs +++ b/csharp/App/Backend/Mailer/Mailer.cs @@ -13,6 +13,9 @@ public static class Mailer var config = JsonSerializer.Deserialize(File.OpenRead("./Resources/smtpConfig.json"))!; var email = new MimeMessage(); + try + { + email.From.Add(new MailboxAddress("InnovEnergy", "noreply@innov.energy")); email.To.Add(new MailboxAddress(emailRecipientUser.Name, emailRecipientUser.Email)); @@ -27,8 +30,13 @@ public static class Mailer smtp.Authenticate(config.Username, config.Password); - smtp.Send(email); - smtp.Disconnect(true); + smtp.Send(email); + smtp.Disconnect(true); + } + catch (Exception) + { + return false; + } return true; } diff --git a/csharp/App/Backend/db.sqlite b/csharp/App/Backend/db.sqlite index f578564dc..e88024675 100644 Binary files a/csharp/App/Backend/db.sqlite and b/csharp/App/Backend/db.sqlite differ diff --git a/csharp/Lib/Utils/EnumerableUtils.cs b/csharp/Lib/Utils/EnumerableUtils.cs index af9cc1998..609258c37 100644 --- a/csharp/Lib/Utils/EnumerableUtils.cs +++ b/csharp/Lib/Utils/EnumerableUtils.cs @@ -68,7 +68,23 @@ public static class EnumerableUtils // } + public static Queue ToQueue(this IEnumerable ts) + { + var q = new Queue(); + foreach (var t in ts) + q.Enqueue(t); + return q; + } + + public static Stack ToStack(this IEnumerable ts) + { + var s = new Stack(); + foreach (var t in ts) + s.Push(t); + + return s; + } public static async IAsyncEnumerable SelectManyAsync(this IEnumerable ts, Func>> func) diff --git a/python/gui/__pycache__/cytoscape.cpython-310.pyc b/python/gui/__pycache__/cytoscape.cpython-310.pyc index 67ea37fbf..7c329be18 100644 Binary files a/python/gui/__pycache__/cytoscape.cpython-310.pyc and b/python/gui/__pycache__/cytoscape.cpython-310.pyc differ diff --git a/python/gui/__pycache__/flatten.cpython-310.pyc b/python/gui/__pycache__/flatten.cpython-310.pyc index a10772449..36ec8fcc2 100644 Binary files a/python/gui/__pycache__/flatten.cpython-310.pyc and b/python/gui/__pycache__/flatten.cpython-310.pyc differ diff --git a/python/gui/__pycache__/templates.cpython-310.pyc b/python/gui/__pycache__/templates.cpython-310.pyc index 0c61bfc2f..1e1eaf086 100644 Binary files a/python/gui/__pycache__/templates.cpython-310.pyc and b/python/gui/__pycache__/templates.cpython-310.pyc differ diff --git a/python/gui/graphs.py b/python/gui/graphs.py index 394d2b2e9..7bfb5a49a 100644 --- a/python/gui/graphs.py +++ b/python/gui/graphs.py @@ -475,12 +475,7 @@ def update_graphs(n, graphs): # TODO GRAB NEW DATA FROM DISK OR S3 timeData = {} #Local copy of allFileNames because we loop over them at the moment - n = allFileNames - number = int(list(set(n) - set(fileNames))[0]) - - # #TODO REMOVE ME - # if number >= 1673427558: - # number = 1673427378 + number = [item for item in allFileNames if item not in fileNames][n % len(allFileNames)-1] fileNames.pop(0) fileNames.append(str(number)) @@ -527,8 +522,8 @@ def update_graphs(n, graphs): devices[k].power[1] = fig["data"][0]['y'][0] fig["data"][0]['x'][0] = now(filename) - fig["data"][0]['y'] = np.roll(fig["data"][0]['y'], -1) - fig["data"][0]['x'] = np.roll(fig["data"][0]['x'], -1) + fig["data"][0]['y'] = fig["data"][0]['y'][-1:] + fig["data"][0]['y'][:-1] + fig["data"][0]['x'] = fig["data"][0]['x'][-1:] + fig["data"][0]['x'][:-1] continue if "Dc" in id["role"].split(" ",1)[1] or "Ac" in id["role"].split(" ",1)[1] or "Alarm" in id["role"] and "Actual" not in id["role"] : @@ -559,11 +554,10 @@ def update_graphs(n, graphs): continue fig["data"][0]['y'][0] = devices[k].data[list(devices[k].data.keys())[-1]][id["role"].split(" ", 1)[1]] - - fig["data"][0]['y'] = np.roll(fig["data"][0]['y'], -1) - fig["data"][0]['x'][0] = now(filename) - fig["data"][0]['x'] = np.roll(fig["data"][0]['x'], -1) + fig["data"][0]['y'] = fig["data"][0]['y'][-1:] + fig["data"][0]['y'][:-1] + fig["data"][0]['x'] = fig["data"][0]['x'][-1:] + fig["data"][0]['x'][:-1] + return graphs # Main HTML Layout of the app ------------------------------------------------------------------------------------------ @@ -635,4 +629,4 @@ app.layout = html.Div(children=[ # Main App Start on specified ip (here local) if __name__ == '__main__': - app.run_server(host= 'localhost', debug=False) \ No newline at end of file + app.run_server(host= 'localhost', debug=False, port=8080) \ No newline at end of file diff --git a/python/gui/templates.py b/python/gui/templates.py index 22c260d55..7505f8c61 100644 --- a/python/gui/templates.py +++ b/python/gui/templates.py @@ -14,7 +14,7 @@ def find_Device_strict(name: str, devices): return [dev for dev in devices if dev.name == name] def now(timestamp): - #return datetime.fromtimestamp(int(timestamp.split("/")[-1])).replace(microsecond=0) + # return datetime.fromtimestamp(int(timestamp.split("/")[-1])).replace(microsecond=0) return datetime.now().replace(microsecond=0) #TODO CHANGE ME WHEN GETTING NEW FILES