add worldwide rating
This commit is contained in:
@@ -11,7 +11,7 @@ using System.Threading;
|
||||
|
||||
namespace OnePeek.Api
|
||||
{
|
||||
public class OnePeekApi : ApiBase, IOnePeekApi
|
||||
public class OnePeekApi : IOnePeekApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Searches for apps based on a term (app name, keywords, ..)
|
||||
|
||||
@@ -87,7 +87,9 @@ namespace OnePeek.WebConsole.Modules
|
||||
{
|
||||
Order = order,
|
||||
Id = Request.Query["id"],
|
||||
Ratings = ratings
|
||||
Ratings = ratings,
|
||||
WorldwideRating = ratings.Where(x => !x.RatingNotAvailable && x.RatingCount > 0).Average(x => x.AverageRating),
|
||||
WorldwideCount = ratings.Sum(x => x.RatingCount)
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
|
||||
@using System.Linq
|
||||
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
|
||||
@{
|
||||
Layout = "_Layout.cshtml";
|
||||
}
|
||||
@@ -12,9 +13,20 @@ ORDER BY<br />
|
||||
|
||||
<br />
|
||||
|
||||
<div class="rating">
|
||||
<h3>Worldwide</h3>
|
||||
<p><span class="label success">OK</span> <b>@Model.WorldwideRating</b> (@Model.WorldwideCount)</p>
|
||||
</div>
|
||||
|
||||
@{
|
||||
string percentage = ((float)Model.WorldwideRating * 20f).ToString("0.00").Replace(",", ".");
|
||||
}
|
||||
|
||||
<div class="progress round secondary"><span class="meter" style="width:@(percentage)%;"></span></div>
|
||||
|
||||
@foreach (var rating in Model.Ratings)
|
||||
{
|
||||
string percentage = ((float)rating.AverageRating * 20f).ToString("0.00").Replace(",", ".");
|
||||
percentage = ((float)rating.AverageRating * 20f).ToString("0.00").Replace(",", ".");
|
||||
<div class="rating">
|
||||
<h3>@rating.Culture</h3>
|
||||
<p><span class="label @(rating.RatingNotAvailable ? "alert" : "success")">@(rating.RatingNotAvailable ? "ERROR" : "OK")</span> <b>@rating.AverageRating</b> (@rating.RatingCount)</p>
|
||||
|
||||
Reference in New Issue
Block a user