Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 4b847de5

Přidáno uživatelem Alex Konig před téměř 4 roky(ů)

re #8933 Testing LoginParser

Zobrazit rozdíly:

Server/ServerApp/Parser/Parsers/LogInParser.cs
15 15
    /// Data parsed from 7am (included) to 18pm (included)
16 16
    /// </summary>
17 17
    /// <author>A. Konig</author>
18
    class LogInParser
18
    public class LogInParser
19 19
    {
20 20
        /// <summary> Datafile loader  </summary>
21 21
        IDataLoader loader;
......
99 99
                // start of the day -> make an instance
100 100
                string place = list[i].building;
101 101
                DateTime date = new DateTime(list[i].date.Year, list[i].date.Month, list[i].date.Day, minmaxHour[0], 0, 0);
102
                DateTime dateOfLessonStart = new DateTime(list[i].date.Year, list[i].date.Month, list[i].date.Day, list[i].lessonStart.Hour, list[i].lessonStart.Minute, list[i].lessonStart.Second);
102 103
                if (!date.Equals(lastStartDay))
103 104
                {
104 105
                    // data for each faculty separate
105 106
                    for (int k = 0; k < TagInfo.buildings.Length; k++)
106 107
                    {
107 108
                        ActivityInfo dayInfo = new ActivityInfo(TagInfo.buildings[k], recordedAmount[k], lastStartDay, range); 
108
                        loginInfo.Add(dayInfo);
109
                        if (recordedAmount[k] != 0)
110
                            loginInfo.Add(dayInfo);
109 111
                    }
110 112

  
111 113
                    recordedAmount = new int[TagInfo.buildings.Length];
......
113 115
                }
114 116

  
115 117
                // if not in allowed time window -> discard
116
                if (list[i].date < startTime || list[i].date > endTime)
118
                if (dateOfLessonStart < startTime || dateOfLessonStart > endTime)
117 119
                    continue;
118 120

  
119 121
                // aggregate data
......
142 144
            for (int k = 0; k < TagInfo.buildings.Length; k++)
143 145
            {
144 146
                ActivityInfo dayInfo = new ActivityInfo(TagInfo.buildings[k], recordedAmount[k], lastStartDay, range);
145
                loginInfo.Add(dayInfo);
147
                if (recordedAmount[k] != 0)
148
                    loginInfo.Add(dayInfo);
146 149
            }
147 150

  
148 151
            return loginInfo;
......
192 195
                // start of the day -> make an instance
193 196
                string place = list[i].building;
194 197
                DateTime date = new DateTime(list[i].date.Year, list[i].date.Month, list[i].date.Day, list[i].lessonStart.Hour, 0, 0);
198
                DateTime dateOfLessonStart = new DateTime(list[i].date.Year, list[i].date.Month, list[i].date.Day, list[i].lessonStart.Hour, list[i].lessonStart.Minute, list[i].lessonStart.Second);
195 199

  
196 200
                // end of the day
197 201
                if (!(date.Year == lastStartTime.Year && date.Month == lastStartTime.Month && date.Day == lastStartTime.Day))
......
205 209
                        for (int l = 0; l < TagInfo.buildings.Length; l++)
206 210
                        {
207 211
                            ActivityInfo dayInfo = new ActivityInfo(TagInfo.buildings[l], data[k][l], stTime, interval);
208
                            loginInfo.Add(dayInfo);
212
                            if (data[k][l] != 0)
213
                                loginInfo.Add(dayInfo);
209 214
                        }
210 215

  
211 216
                        data[k] = new int[TagInfo.buildings.Length];
......
214 219
                }
215 220

  
216 221
                // if not in allowed time window -> discard
217
                if (list[i].date < startTime || list[i].date > endTime)
222
                if (dateOfLessonStart < startTime || dateOfLessonStart > endTime)
218 223
                    continue;
219 224

  
220 225
                // find index for current instance
......
262 267
                for (int l = 0; l < TagInfo.buildings.Length; l++)
263 268
                {
264 269
                    ActivityInfo dayInfo = new ActivityInfo(TagInfo.buildings[l], data[k][l], stTime, interval);
265
                    loginInfo.Add(dayInfo);
270
                    if (data[k][l] != 0)
271
                        loginInfo.Add(dayInfo);
266 272
                }
267 273
            }
268 274

  

Také k dispozici: Unified diff