File tree 1 file changed +3
-14
lines changed
1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,7 @@ private async Task UpdateAlerts()
105
105
{
106
106
List < TransitTrafficAlert > newAlerts = response
107
107
. Result
108
- . Distinct ( _transitTrafficAlertComparer ) // Sometimes we get a bunch of duplicate alerts that have different IDs, but no other difference
109
- . Where ( x => ! String . IsNullOrWhiteSpace ( x . DescriptionText ? . Text ) ) // or empty alerts
108
+ . Distinct ( _transitTrafficAlertComparer )
110
109
. OrderBy ( x => x . StartDate )
111
110
. ToList ( ) ;
112
111
AreAlertsFresh = newAlerts . Any ( newAlert => TrafficAlerts . All ( oldAlert => oldAlert . Id != newAlert . Id ) ) ;
@@ -148,22 +147,12 @@ internal class TransitTrafficAlertComparer : IEqualityComparer<TransitTrafficAle
148
147
{
149
148
public bool Equals ( TransitTrafficAlert x , TransitTrafficAlert y )
150
149
{
151
- return x . DescriptionText . Language == y . DescriptionText . Language
152
- && x . DescriptionText . Text == y . DescriptionText . Text
153
- && x . StartDate == y . StartDate
154
- && x . EndDate == y . EndDate ;
150
+ return x . Id == y . Id ;
155
151
}
156
152
157
153
public int GetHashCode ( TransitTrafficAlert obj )
158
154
{
159
- unchecked
160
- {
161
- var hashCode = obj . DescriptionText != null ? obj . DescriptionText . Language . GetHashCode ( ) : 0 ;
162
- hashCode = ( hashCode * 397 ) ^ obj . DescriptionText ? . Text ? . GetHashCode ( ) ?? 0 ;
163
- hashCode = ( hashCode * 397 ) ^ obj . StartDate . GetHashCode ( ) ;
164
- hashCode = ( hashCode * 397 ) ^ obj . EndDate . GetHashCode ( ) ;
165
- return hashCode ;
166
- }
155
+ return obj ? . Id ? . GetHashCode ( ) ?? 0 ;
167
156
}
168
157
}
169
158
}
You can’t perform that action at this time.
0 commit comments