-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add subscriptions to the check aggregator to enable multiple webviews (…
- Loading branch information
Showing
24 changed files
with
1,462 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,52 @@ | ||
using System.Text.Json.Serialization; | ||
using SIL.Scripture; | ||
|
||
namespace Paranext.DataProvider.Checks; | ||
|
||
/// <summary> | ||
/// Represents a single error/issue flagged by a check in a given project. This class must | ||
/// serialize/deserialize to the CheckRunResult type defined in TypeScript. | ||
/// </summary> | ||
public sealed class CheckRunResult( | ||
string checkId, | ||
string projectId, | ||
string messageFormatString, | ||
string text, | ||
CheckLocation start, | ||
CheckLocation end | ||
public sealed record CheckRunResult( | ||
string CheckId, | ||
string CheckResultType, | ||
string ProjectId, | ||
string MessageFormatString, | ||
[property: JsonIgnore] string Text, | ||
bool IsDenied, | ||
VerseRef VerseRef, | ||
CheckLocation Start, | ||
CheckLocation End | ||
) : IEquatable<CheckRunResult> | ||
{ | ||
public string CheckId { get; } = checkId; | ||
public string ProjectId { get; } = projectId; | ||
public string MessageFormatString { get; } = messageFormatString; | ||
|
||
[JsonIgnore] | ||
public string Text { get; } = text; | ||
public CheckLocation Start { get; } = start; | ||
public CheckLocation End { get; } = end; | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
return obj is CheckRunResult checkRunResult && Equals(checkRunResult); | ||
} | ||
|
||
public bool Equals(CheckRunResult? other) | ||
{ | ||
if (ReferenceEquals(other, null)) | ||
if (other is null) | ||
return false; | ||
|
||
return CheckId == other.CheckId | ||
&& CheckResultType == other.CheckResultType | ||
&& ProjectId == other.ProjectId | ||
&& MessageFormatString == other.MessageFormatString | ||
&& Text == other.Text | ||
&& IsDenied == other.IsDenied | ||
&& VerseRef.ToStringWithVersification() == other.VerseRef.ToStringWithVersification() | ||
&& Start == other.Start | ||
&& End == other.End; | ||
} | ||
|
||
public static bool operator ==(CheckRunResult a, CheckRunResult b) | ||
{ | ||
return a.Equals(b); | ||
} | ||
|
||
public static bool operator !=(CheckRunResult a, CheckRunResult b) | ||
{ | ||
return !(a == b); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return HashCode.Combine(CheckId, ProjectId, MessageFormatString, Text, Start, End); | ||
int hash = HashCode.Combine( | ||
CheckId, | ||
CheckResultType, | ||
ProjectId, | ||
MessageFormatString, | ||
Text, | ||
IsDenied, | ||
VerseRef, | ||
Start | ||
); | ||
return HashCode.Combine(hash, End); | ||
} | ||
} |
Oops, something went wrong.