Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scorecards overview now displays sentiment information #506

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
ID: "d2119d68-ccc0-45bc-b730-f4a97fcaeaf7"
Parent: "08dcd930-6bd6-4072-9997-92bc3423d1ac"
Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
Path: /sitecore/templates/Feature/Selections/Admin/ScoreCards/ScoreCards/Table Headers/SentimentsTableHeader
SharedFields:
- ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
Hint: Type
Value: "Single-Line Text"
- ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
Hint: __Sortorder
Value: 800
Languages:
- Language: en
Fields:
- ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
Hint: Title
Value: Sentiments
Versions:
- Version: 1
Fields:
- ID: "25bed78c-4957-4165-998a-ca1b52f67497"
Hint: __Created
Value: 20250102T141741Z
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103"
Hint: __Owner
Value: |
sitecore\ivan.lieckens@sitecore.com
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
Hint: __Created by
Value: |
sitecore\ivan.lieckens@sitecore.com
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f"
Hint: __Revision
Value: "b2dbba94-7fcc-41ee-9a2f-56f9f0399d53"
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a"
Hint: __Updated by
Value: |
sitecore\ivan.lieckens@sitecore.com
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522"
Hint: __Updated
Value: 20250102T141758Z
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Languages:
Value: Average
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f"
Hint: __Revision
Value: "dd7b8f06-73e4-421c-82b8-e65cfcb4d30b"
Value: "6b87a581-bd5f-4cb5-b827-8a7a2a999e5e"
- ID: "90cc1848-ea0f-467d-bc9b-eb09d1b29d17"
Hint: MedianTableHeader
Value: Median
Expand All @@ -55,10 +55,13 @@ Languages:
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a"
Hint: __Updated by
Value: |
sitecore\iva@sitecore.net
sitecore\ivan.lieckens@sitecore.com
- ID: "d2119d68-ccc0-45bc-b730-f4a97fcaeaf7"
Hint: SentimentsTableHeader
Value: Sentiments
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522"
Hint: __Updated
Value: 20230114T200405Z
Value: 20250102T141839Z
- ID: "da68863c-2e37-46d7-b798-6e988824a349"
Hint: NameTableHeader
Value: Name
Expand Down
8 changes: 2 additions & 6 deletions headapps/MvpSite/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,24 @@
<PlatformVersion>1.*</PlatformVersion>
<AspNetCoreSdkVersion>0.0.11</AspNetCoreSdkVersion>
</PropertyGroup>

<ItemGroup Label="Rendering Host Package References">
<PackageVersion Include="Sitecore.AspNetCore.SDK.LayoutService.Client" Version="$(AspNetCoreSdkVersion)" />
<PackageVersion Include="Sitecore.AspNetCore.SDK.RenderingEngine" Version="$(AspNetCoreSdkVersion)" />
<PackageVersion Include="Sitecore.AspNetCore.SDK.ExperienceEditor" Version="$(AspNetCoreSdkVersion)" />

<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0"/>
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="System.ServiceModel.Syndication" Version="8.0.0" />

<PackageVersion Include="BuildWebCompiler" Version="1.12.405" />
<PackageVersion Include="GraphQL.Client" Version="4.0.2" />
<PackageVersion Include="GraphQL.Client.Serializer.Newtonsoft" Version="4.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.Session" Version="2.2.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
<PackageVersion Include="Okta.AspNetCore" Version="4.5.0" />
<PackageVersion Include="Mvp.Selections.Client" Version="4.16.0" />
<PackageVersion Include="Mvp.Selections.Client" Version="4.18.0" />
<PackageVersion Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageVersion Include="Markdig" Version="0.37.0" />
</ItemGroup>

<ItemGroup Label="Global Project Tooling">
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
Expand Down
13 changes: 13 additions & 0 deletions headapps/MvpSite/MvpSite.Rendering/Models/Admin/ScoreCardsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class ScoreCardsModel : BaseModel

public TextField? MaxTableHeader { get; set; }

public TextField? SentimentsTableHeader { get; set; }

public HyperLinkField? DetailLink { get; set; }

public HyperLinkField? AwardLink { get; set; }
Expand All @@ -56,4 +58,15 @@ public static string Color(int score)
_ => "red"
};
}

public static string BadgeClass(ReviewSentiment sentiment)
{
return sentiment switch
{
ReviewSentiment.Yes => "badge-success",
ReviewSentiment.Maybe => "badge-warning",
ReviewSentiment.No => "badge-danger",
_ => "badge-dark"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@if (review.Sentiment.HasValue)
{
<text>
Sentiment: <span class="badge @(review.Sentiment == ReviewSentiment.Yes ? "badge-success" : review.Sentiment == ReviewSentiment.Maybe ? "badge-warning" : review.Sentiment == ReviewSentiment.No ? "badge-danger" : "badge-dark")">@review.Sentiment</span>
Sentiment: <span class="badge @ScoreCardsModel.BadgeClass(review.Sentiment.Value)">@review.Sentiment</span>
</text>
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<th asp-for="MedianTableHeader"></th>
<th asp-for="MinTableHeader"></th>
<th asp-for="MaxTableHeader"></th>
<th asp-for="SentimentsTableHeader"></th>
<th></th>
</tr>
</thead>
Expand Down Expand Up @@ -80,6 +81,12 @@
<td style="color: @ScoreCardsModel.Color(card.Median);">@card.Median%</td>
<td style="color: @ScoreCardsModel.Color(card.Min);">@card.Min%</td>
<td style="color: @ScoreCardsModel.Color(card.Max);">@card.Max%</td>
<td>
@foreach (KeyValuePair<ReviewSentiment, int> sentimentCount in Model.ScoreCards[i].Sentiments)
{
<span class="badge @ScoreCardsModel.BadgeClass(sentimentCount.Key)">@sentimentCount.Value</span><br/>
}
</td>
<td>
<a asp-for="DetailLink" href="@Model.DetailLink?.Value.Href?applicationid=@card.Applicant?.ApplicationId" class="btn btn-secondary"><i class="fa fa-eye" aria-hidden="true"></i></a>
@if (title != null)
Expand Down
Loading