diff --git a/GanjooRazor/Pages/Contribs.cshtml b/GanjooRazor/Pages/Contribs.cshtml index c04bacaf..67eaabe6 100644 --- a/GanjooRazor/Pages/Contribs.cshtml +++ b/GanjooRazor/Pages/Contribs.cshtml @@ -25,6 +25,26 @@ cookieValue = getCookie("stickyEnabled"); var stickyEnabled = cookieValue != "false"; + diff --git a/GanjooRazor/Pages/Contribs.cshtml.cs b/GanjooRazor/Pages/Contribs.cshtml.cs index 7a1e9097..cc0e900e 100644 --- a/GanjooRazor/Pages/Contribs.cshtml.cs +++ b/GanjooRazor/Pages/Contribs.cshtml.cs @@ -145,22 +145,22 @@ namespace GanjooRazor.Pages return new BadRequestObjectResult(JsonConvert.DeserializeObject(await responseDays.Content.ReadAsStringAsync())); } var days = JArray.Parse(await responseDays.Content.ReadAsStringAsync()).ToObject>(); - if (days == null) - { - return new BadRequestObjectResult("خطا در دسترسی به آمار روزانه"); - } - var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/contributions/{dataType}/by/user?PageNumber=1&PageSize=30"); + var responseUsers = await _httpClient.GetAsync($"{APIRoot.Url}/api/contributions/{dataType}/by/user?PageNumber=1&PageSize=30"); + + if (!responseUsers.IsSuccessStatusCode) + { + return new BadRequestObjectResult(JsonConvert.DeserializeObject(await responseUsers.Content.ReadAsStringAsync())); + } + List users = dataType == "users" ? null : JArray.Parse(await responseUsers.Content.ReadAsStringAsync()).ToObject>(); + + var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/contributions/{dataType}/summary"); if (!response.IsSuccessStatusCode) { return new BadRequestObjectResult(JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync())); } - var users = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>(); - if (users == null) - { - return new BadRequestObjectResult("خطا در دسترسی به آمار کاربران"); - } + SummedUpViewModel summary = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); return new PartialViewResult() { @@ -171,6 +171,7 @@ namespace GanjooRazor.Pages { Days = days.ToArray(), Users = users.ToArray(), + Summary = summary } } }; diff --git a/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml b/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml index 7f061475..69651ba2 100644 --- a/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml +++ b/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml @@ -1,4 +1,28 @@ @model GanjooRazor.Pages._GroupedByDateViewPartialModel @{ } +@if (Model.Summary != null) +{ +
+ @if (Model.Summary.Days != -1) + { +
+
@RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.Summary.Days)
+
روز فعالیت
+
+ } +
+
@RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.Summary.TotalCount)
+
تعداد کل ویرایش‌ها
+
+ @if (Model.Summary.UserIds != -1) + { +
+
@RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.Summary.UserIds)
+
کاربران مشارکت کننده
+
+ } +
+} + diff --git a/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml.cs b/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml.cs index ca6ef3fc..32ad2832 100644 --- a/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml.cs +++ b/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml.cs @@ -9,6 +9,8 @@ namespace GanjooRazor.Pages public GroupedByUserViewModel[] Users { get; set; } + public SummedUpViewModel Summary { get; set; } + public _GroupedByDateViewTablePartialModel TableModel { get