Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit af62175

Browse files
Adding a Default instance for comparison
1 parent 73e52e1 commit af62175

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/GitHub.Exports/Models/UsageModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ namespace GitHub.Models
55
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "It'll use reflection by default and we're fine with that")]
66
public struct UsageModel
77
{
8+
public static UsageModel Default = new UsageModel
9+
{
10+
Guid = Guid.Empty
11+
};
12+
813
public Guid Guid { get; set; }
914
public DateTimeOffset Date { get; set; }
1015
public string AppVersion { get; set; }

src/GitHub.VisualStudio/Services/UsageTracker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async Task<UsageModel> GetCurrentReport(UsageData data)
131131
{
132132
var current = data.Reports.FirstOrDefault(x => x.Date.Date == DateTimeOffset.Now.Date);
133133

134-
if (current == null)
134+
if (current.Equals(UsageModel.Default))
135135
{
136136
var guid = await service.GetUserGuid();
137137
current = UsageModel.Create(guid);

0 commit comments

Comments
 (0)