Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ecdce631

Přidáno uživatelem Alex Konig před více než 3 roky(ů)

re #8610 Fixing mistakes in start times

Zobrazit rozdíly:

Server/ServerApp/Parser/Parsers/DataParser.cs
59 59
            string pathLogIn = path + "login";
60 60

  
61 61
            weatherList = weatherParser.ParseWeatherData(pathWeather, wholeDay, interval);
62
            jisList = jisParser.ParseJisData(pathJis, wholeDay, interval);
62
            jisList = jisParser.ParseJisData(pathJis, false, 2); // wholeDay, interval);
63 63
            loginList = loginParser.ParseLogInData(pathLogIn, false, 2); // wholeDay, interval);
64 64

  
65 65
            //Console.WriteLine("WEATHER");
66 66
            //WriteToConsole(weatherList);
67
            //Console.WriteLine("JIS");
68
            //WriteToConsole(jisList);
69
            Console.WriteLine("LOGIN");
70
            WriteToConsole(loginList);
67
            Console.WriteLine("JIS");
68
            WriteToConsole(jisList);
69
            //Console.WriteLine("LOGIN");
70
            //WriteToConsole(loginList);
71 71
        }
72 72

  
73 73
        /// <summary>
Server/ServerApp/Parser/Parsers/JisParser.cs
138 138
                return null;
139 139

  
140 140
            int indices = (int) Math.Ceiling(range / (double)interval);
141
            int[] from = new int[indices];
142
            for (int i = 0; i < from.Length; i++) {
143
                from[i] = minmaxHour[0] + interval * (i+1);
144
                Console.Write(from[i] + " ");
145
            }
146
            Console.WriteLine();
141
            int[] to = new int[indices];
142
            for (int i = 0; i < to.Length; i++) 
143
                to[i] = minmaxHour[0] + interval * (i+1);
147 144

  
148 145
            // first day
149 146
            DateTime lastStartTime = new DateTime(list[0].dateTime.Year, list[0].dateTime.Month, list[0].dateTime.Day, minmaxHour[0], 0, 0);
150
            int endtime = from[0];
147
            int endtime = to[0];
151 148
            int startTime = minmaxHour[0];
152 149
            int index = 0;
153 150
            for (int i = 0; i < list.Count; i++)
......
164 161
                // end of the day
165 162
                if (!(date.Year == lastStartTime.Year && date.Month == lastStartTime.Month && date.Day == lastStartTime.Day))
166 163
                {
167
                    endtime = from[0];
168
                    startTime = minmaxHour[0];
169 164
                    trigger = true;
170 165
                    index = 0;
171 166
                }
172 167

  
173 168
                // end of interval period
174
                if ( date.Hour >= endtime || trigger) // date.Hour > endTime (date.Hour - lastStartTime.Hour) >= interval 
169
                if ( date.Hour >= endtime || trigger) 
175 170
                {
176 171
                    // start time of last interval
177 172
                    DateTime stTime = new DateTime(lastStartTime.Year, lastStartTime.Month, lastStartTime.Day, startTime, 0, 0);
178
                    
179
                    // end of interval, not end of day -> need to find appropriate start and end times
173

  
174
                    // find end and start time
180 175
                    if (!trigger)
181
                    {
182
                        index += 1;
183
                        while (from[index] < date.Hour)
184
                            index++;
176
                        index++;
177
                    while (date.Hour >= to[index])
178
                        index++;
185 179

  
186
                        endtime = from[index];
187
                        startTime = from[index - 1];
188
                    }
180
                    endtime = to[index];
181
                    if (index == 0)
182
                        startTime = minmaxHour[0];
183
                    else
184
                        startTime = to[index - 1];
189 185

  
190 186
                    // data for each faculty separate
191 187
                    for (int k = 0; k < TagInfo.faculties.Length; k++)
Server/ServerApp/Parser/Parsers/LogInParser.cs
152 152
                data[i] = new int[TagInfo.faculties.Length];
153 153
            }
154 154
            
155
            // 0.15h sem todle už dělal
156
            // +1h
157
            // udělat gitignore
158

  
159 155
            // first day
160 156
            DateTime lastStartTime = new DateTime(list[0].date.Year, list[0].date.Month, list[0].date.Day, minmaxHour[0], 0, 0);
161 157
            int index = 0;
Server/ServerApp/ServerApp.csproj
73 73
    <None Include="data\jis\OD_ZCU_JIS_11_2019.CSV">
74 74
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
75 75
    </None>
76
    <None Include="data\jis\OD_ZCU_JIS_13_2019.CSV">
77
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
78
    </None>
76 79
    <None Include="data\jis\OD_ZCU_JIS_12_2019.CSV">
77 80
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
78 81
    </None>
......
88 91
    <None Include="data\login\OD_ZCU_STROJE_11_2019.CSV">
89 92
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
90 93
    </None>
91
    <None Include="data\login\OD_ZCU_STROJE_12_2019 - Copy.CSV">
94
    <None Include="data\login\OD_ZCU_STROJE_12_2019.CSV">
92 95
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
93 96
    </None>
94 97
    <None Include="data\login\OD_ZCU_STROJE_13_2019.CSV">
Server/ServerApp/data/jis/OD_ZCU_JIS_13_2019.CSV
1
"M14";"01.12.2019 07:03:03";1
2
"L1L2-vchod";"01.12.2019 07:22:38";1
3
"L2";"01.12.2019 08:22:53";1
4
"A1";"01.12.2019 09:31:19";1
5
"M14";"01.12.2019 10:35:40";1
6
"A3";"02.12.2019 07:47:04";1
7
"L2";"02.12.2019 10:48:11";1
8
"A1";"02.12.2019 11:53:10";1
9
"M16";"02.12.2019 12:19:27";1
10
"L1L2-vchod";"02.12.2019 12:30:06";1
11
"L2";"03.12.2019 07:30:23";1
12
"M16";"03.12.2019 07:44:09";1
13
"A3";"03.12.2019 15:45:05";1
14
"L1";"03.12.2019 16:26:58";1
15
"A1";"03.12.2019 17:27:46";1
16
"M16";"05.12.2019 17:48:26";1
17
"L1L2-vchod";"05.12.2019 18:15:33";1
18
"L2";"05.12.2019 18:15:48";1
19
"M14";"05.12.2019 19:19:45";1
20
"L2";"05.12.2019 19:25:16";1

Také k dispozici: Unified diff