commit 1db865ce7d479e8d3d6f22a5258e260a5bcab866
Author: A-Konig <alex-nebulae@seznam.cz>
Date:   Wed Apr 14 20:30:18 2021 +0200

    re #8610 Parsing in stable intervals

diff --git a/Server/.vs/ServerApp/v16/.suo b/Server/.vs/ServerApp/v16/.suo
index 518c7ef..3a5c231 100644
Binary files a/Server/.vs/ServerApp/v16/.suo and b/Server/.vs/ServerApp/v16/.suo differ
diff --git a/Server/ServerApp/Parser/Parsers/JisParser.cs b/Server/ServerApp/Parser/Parsers/JisParser.cs
index 893621c..934bb9e 100644
--- a/Server/ServerApp/Parser/Parsers/JisParser.cs
+++ b/Server/ServerApp/Parser/Parsers/JisParser.cs
@@ -147,6 +147,9 @@ namespace ServerApp.Parser.Parsers
 
             // first day
             DateTime lastStartTime = new DateTime(list[0].dateTime.Year, list[0].dateTime.Month, list[0].dateTime.Day, minmaxHour[0], 0, 0);
+            int endtime = from[0];
+            int startTime = minmaxHour[0];
+            int index = 0;
             for (int i = 0; i < list.Count; i++)
             {
                 int currHour = list[i].dateTime.Hour;
@@ -157,18 +160,37 @@ namespace ServerApp.Parser.Parsers
                 string place = list[i].placeTag;
                 bool trigger = false;
                 DateTime date = new DateTime(list[i].dateTime.Year, list[i].dateTime.Month, list[i].dateTime.Day, list[i].dateTime.Hour, 0, 0);
-               
+
                 // end of the day
                 if (!(date.Year == lastStartTime.Year && date.Month == lastStartTime.Month && date.Day == lastStartTime.Day))
+                {
+                    endtime = from[0];
+                    startTime = minmaxHour[0];
                     trigger = true;
+                    index = 0;
+                }
 
                 // end of interval period
-                if ( (date.Hour - lastStartTime.Hour) >= interval || trigger)
+                if ( date.Hour >= endtime || trigger) // date.Hour > endTime (date.Hour - lastStartTime.Hour) >= interval 
                 {
+                    // start time of last interval
+                    DateTime stTime = new DateTime(lastStartTime.Year, lastStartTime.Month, lastStartTime.Day, startTime, 0, 0);
+                    
+                    // end of interval, not end of day -> need to find appropriate start and end times
+                    if (!trigger)
+                    {
+                        index += 1;
+                        while (from[index] < date.Hour)
+                            index++;
+
+                        endtime = from[index];
+                        startTime = from[index - 1];
+                    }
+
                     // data for each faculty separate
                     for (int k = 0; k < TagInfo.faculties.Length; k++)
                     {
-                        ActivityInfo dayInfo = new ActivityInfo(TagInfo.faculties[k], recordedAmount[k], lastStartTime, interval);
+                        ActivityInfo dayInfo = new ActivityInfo(TagInfo.faculties[k], recordedAmount[k], stTime, interval);
                         jisInfo.Add(dayInfo);
                     }
 
@@ -179,12 +201,12 @@ namespace ServerApp.Parser.Parsers
                 // aggregate data
                 if (TagInfo.jisPlaces.ContainsKey(place))
                 {
-                    int index = TagInfo.jisPlaces[place];
-                    if (index == -1)
+                    int faculty = TagInfo.jisPlaces[place];
+                    if (faculty == -1)
                         for (int l = 0; l < TagInfo.faculties.Length; l++)
                             recordedAmount[l] += list[i].amount;
                     else
-                        recordedAmount[index] += list[i].amount;
+                        recordedAmount[faculty] += list[i].amount;
 
                 }
                 else
diff --git a/Server/ServerApp/bin/Debug/ServerApp.exe b/Server/ServerApp/bin/Debug/ServerApp.exe
index 1757f2a..fef2c05 100644
Binary files a/Server/ServerApp/bin/Debug/ServerApp.exe and b/Server/ServerApp/bin/Debug/ServerApp.exe differ
diff --git a/Server/ServerApp/bin/Debug/ServerApp.pdb b/Server/ServerApp/bin/Debug/ServerApp.pdb
index 823f419..c4acee2 100644
Binary files a/Server/ServerApp/bin/Debug/ServerApp.pdb and b/Server/ServerApp/bin/Debug/ServerApp.pdb differ
diff --git a/Server/ServerApp/obj/Debug/ServerApp.csprojAssemblyReference.cache b/Server/ServerApp/obj/Debug/ServerApp.csprojAssemblyReference.cache
index 262abda..215ea7b 100644
Binary files a/Server/ServerApp/obj/Debug/ServerApp.csprojAssemblyReference.cache and b/Server/ServerApp/obj/Debug/ServerApp.csprojAssemblyReference.cache differ
diff --git a/Server/ServerApp/obj/Debug/ServerApp.exe b/Server/ServerApp/obj/Debug/ServerApp.exe
index 1757f2a..fef2c05 100644
Binary files a/Server/ServerApp/obj/Debug/ServerApp.exe and b/Server/ServerApp/obj/Debug/ServerApp.exe differ
diff --git a/Server/ServerApp/obj/Debug/ServerApp.pdb b/Server/ServerApp/obj/Debug/ServerApp.pdb
index 823f419..c4acee2 100644
Binary files a/Server/ServerApp/obj/Debug/ServerApp.pdb and b/Server/ServerApp/obj/Debug/ServerApp.pdb differ
