Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1db865ce

Přidáno uživatelem Alex Konig před asi 4 roky(ů)

re #8610 Parsing in stable intervals

Zobrazit rozdíly:

Server/ServerApp/Parser/Parsers/JisParser.cs
147 147

  
148 148
            // first day
149 149
            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];
151
            int startTime = minmaxHour[0];
152
            int index = 0;
150 153
            for (int i = 0; i < list.Count; i++)
151 154
            {
152 155
                int currHour = list[i].dateTime.Hour;
......
157 160
                string place = list[i].placeTag;
158 161
                bool trigger = false;
159 162
                DateTime date = new DateTime(list[i].dateTime.Year, list[i].dateTime.Month, list[i].dateTime.Day, list[i].dateTime.Hour, 0, 0);
160
               
163

  
161 164
                // end of the day
162 165
                if (!(date.Year == lastStartTime.Year && date.Month == lastStartTime.Month && date.Day == lastStartTime.Day))
166
                {
167
                    endtime = from[0];
168
                    startTime = minmaxHour[0];
163 169
                    trigger = true;
170
                    index = 0;
171
                }
164 172

  
165 173
                // end of interval period
166
                if ( (date.Hour - lastStartTime.Hour) >= interval || trigger)
174
                if ( date.Hour >= endtime || trigger) // date.Hour > endTime (date.Hour - lastStartTime.Hour) >= interval 
167 175
                {
176
                    // start time of last interval
177
                    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
180
                    if (!trigger)
181
                    {
182
                        index += 1;
183
                        while (from[index] < date.Hour)
184
                            index++;
185

  
186
                        endtime = from[index];
187
                        startTime = from[index - 1];
188
                    }
189

  
168 190
                    // data for each faculty separate
169 191
                    for (int k = 0; k < TagInfo.faculties.Length; k++)
170 192
                    {
171
                        ActivityInfo dayInfo = new ActivityInfo(TagInfo.faculties[k], recordedAmount[k], lastStartTime, interval);
193
                        ActivityInfo dayInfo = new ActivityInfo(TagInfo.faculties[k], recordedAmount[k], stTime, interval);
172 194
                        jisInfo.Add(dayInfo);
173 195
                    }
174 196

  
......
179 201
                // aggregate data
180 202
                if (TagInfo.jisPlaces.ContainsKey(place))
181 203
                {
182
                    int index = TagInfo.jisPlaces[place];
183
                    if (index == -1)
204
                    int faculty = TagInfo.jisPlaces[place];
205
                    if (faculty == -1)
184 206
                        for (int l = 0; l < TagInfo.faculties.Length; l++)
185 207
                            recordedAmount[l] += list[i].amount;
186 208
                    else
187
                        recordedAmount[index] += list[i].amount;
209
                        recordedAmount[faculty] += list[i].amount;
188 210

  
189 211
                }
190 212
                else

Také k dispozici: Unified diff