Updated Profile
Updated profile to more properly iterate over subscriptions for equality checking to ensure subs properly match up.
This commit is contained in:
parent
d4a9b88cc0
commit
8d53ce79f3
1 changed files with 10 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using FreeTubeSyncer.Library;
|
||||
|
||||
|
|
@ -38,8 +39,15 @@ public class Profile : IDataModel, IEquatable<Profile>
|
|||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return _id == other._id && name == other.name && bgColor == other.bgColor && textColor == other.textColor &&
|
||||
subscriptions.Equals(other.subscriptions);
|
||||
if (subscriptions.Count != other.subscriptions.Count) return false;
|
||||
foreach (var sub in subscriptions)
|
||||
{
|
||||
var osub = other.subscriptions.FirstOrDefault(x => x.id == sub.id);
|
||||
if (osub is null) return false;
|
||||
if (!osub.Equals(sub)) return false;
|
||||
}
|
||||
|
||||
return _id == other._id && name == other.name && bgColor == other.bgColor && textColor == other.textColor;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue