v1.2.5.1
This commit is contained in:
@@ -227,7 +227,7 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
SysId organisationId = new SysId(values.GetLong(colOrganisationId.DataName));
|
||||
String organisation = values.GetString(colOrganisation.DataName);
|
||||
SysId authorId = new SysId(values.GetLong(colAuthorId.DataName));
|
||||
String author = values.GetString(colAuthor.DataName);
|
||||
String author = Internals.ActivityMgr.GetArticleDataValue(colAuthor, values).ToString();
|
||||
String headline = values.GetString(colHeadline.DataName);
|
||||
String summary = values.GetString(colSummary.DataName);
|
||||
SysId sportId = new SysId(values.GetLong(colSportId.DataName));
|
||||
|
||||
@@ -15,6 +15,7 @@ using Saxonite.Net.Standard.Base.Mgr;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
@@ -181,23 +182,35 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Period.
|
||||
indexContext.EffectiveTo = DateTime.Today;
|
||||
|
||||
// Search filter is dissected to extract regions and sports.
|
||||
String searchFilter = model.Filter.Search.TrimAll();
|
||||
List<SysId> sportIds = ExtractSearchFilterSports(ref searchFilter);
|
||||
List<SysId> regionIds = ExtractSearchFilterRegions(ref searchFilter);
|
||||
|
||||
// Sport and region combinations.
|
||||
List<SysId> sportIds = new List<SysId>();
|
||||
foreach (SysId sportId in sessionData.Profile.Sports.Select(item => item.SportId))
|
||||
if (sportIds.IsEmpty())
|
||||
{
|
||||
if (sportIds.Contains(sportId)) continue;
|
||||
sportIds.AddId(sportId);
|
||||
// Include child sports.
|
||||
sportIds.AddIds(model.GetChildSports_Active(sportId).Select(item => item.Id));
|
||||
model.GetSportCaption(sportId);
|
||||
// No sports extractd from search filter - default to user's sports.
|
||||
foreach (SysId sportId in sessionData.Profile.Sports.Select(item => item.SportId))
|
||||
{
|
||||
if (sportIds.Contains(sportId)) continue;
|
||||
sportIds.AddId(sportId);
|
||||
// Include child sports.
|
||||
sportIds.AddIds(model.GetChildSports_Active(sportId).Select(item => item.Id));
|
||||
model.GetSportCaption(sportId);
|
||||
}
|
||||
}
|
||||
if (regionIds.IsEmpty())
|
||||
{
|
||||
// No regions extracted from search filter - default to user's region(s).
|
||||
regionIds.AddId(sessionData.User.RegionIdProvince);
|
||||
if (regionIds.IsEmpty())
|
||||
regionIds.AddId(sessionData.User.RegionIdCountry);
|
||||
}
|
||||
foreach (SysId sportId in sportIds)
|
||||
{
|
||||
// Regions.
|
||||
if (SysId.IsValid(sessionData.User.RegionIdProvince))
|
||||
indexContext.SportRegionIdsIncluded.Add(new SaxActivityIndex.SportRegionIds(sportId, sessionData.User.RegionIdProvince));
|
||||
else if (SysId.IsValid(sessionData.User.RegionIdCountry))
|
||||
indexContext.SportRegionIdsIncluded.Add(new SaxActivityIndex.SportRegionIds(sportId, sessionData.User.RegionIdCountry));
|
||||
foreach (SysId regionId in regionIds)
|
||||
indexContext.SportRegionIdsIncluded.Add(new SaxActivityIndex.SportRegionIds(sportId, regionId));
|
||||
}
|
||||
|
||||
// Populate activities.
|
||||
@@ -236,6 +249,42 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Extract Sports from activity search filter.</summary>
|
||||
private List<SysId> ExtractSearchFilterSports(ref string searchFilter)
|
||||
{
|
||||
List<SysId> sportIds = new List<SysId>();
|
||||
if (StringUtil.IsEmpty(searchFilter)) return sportIds;
|
||||
foreach (SaxSport.Data sport in DataCacheConsole.GetActiveSports())
|
||||
{
|
||||
Regex reSport = new Regex("\\b" + Regex.Escape(sport.Name) + "\\b", RegexOptions.IgnoreCase);
|
||||
Match match = reSport.Match(searchFilter);
|
||||
if (match.Success)
|
||||
{
|
||||
sportIds.Add(sport.Id);
|
||||
searchFilter = reSport.Replace(searchFilter, " ").TrimAll();
|
||||
}
|
||||
}
|
||||
return sportIds;
|
||||
}
|
||||
/// <summary>Extract Regions from activity search filter.</summary>
|
||||
private List<SysId> ExtractSearchFilterRegions(ref string searchFilter)
|
||||
{
|
||||
List<SysId> regionIds = new List<SysId>();
|
||||
if (StringUtil.IsEmpty(searchFilter)) return regionIds;
|
||||
foreach (SaxRegion.Data region in DataCacheConsole.GetActiveRegions())
|
||||
{
|
||||
Regex reRegion = new Regex("\\b" + Regex.Escape(region.Name) + "\\b", RegexOptions.IgnoreCase);
|
||||
Match match = reRegion.Match(searchFilter);
|
||||
if (match.Success)
|
||||
{
|
||||
regionIds.Add(region.Id);
|
||||
searchFilter = reRegion.Replace(searchFilter, " ").TrimAll();
|
||||
}
|
||||
}
|
||||
return regionIds;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Activity Info
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -135,9 +135,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
if (viewCount <= 0) return;
|
||||
data.Feedback = new ArticleData_List.FeedbackData();
|
||||
data.Feedback.Summary = viewCount.ToString();
|
||||
data.Feedback.Summary = feedbackCount.ToString() + "/" + viewCount.ToString();
|
||||
if (feedbackCount > 0)
|
||||
data.Feedback.Summary = feedbackAverage.ToString("N1") + " " + feedbackCount.ToString() + "/" + data.Feedback.Summary;
|
||||
data.Feedback.Summary = feedbackAverage.ToString("N1") + " " + data.Feedback.Summary;
|
||||
data.Feedback.ViewCount = viewCount;
|
||||
data.Feedback.FeedbackCount = feedbackCount;
|
||||
data.Feedback.FeedbackAverage = feedbackAverage.ToString("N1");
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Activity filter.
|
||||
public class FilterData
|
||||
{
|
||||
public String Activity { get; set; }
|
||||
public String Search { get; set; }
|
||||
public String OrganisationId { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
|
||||
@@ -41,7 +41,7 @@ else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-4"><div class="sax-label text-left text-sm-right">@Localiser["label.search"]</div></div>
|
||||
<div class="col-sm-8"><input type="search" name="Filter.Activity" id="ifActivityFilter" class="ActivityFilter sax-input" maxlength="64" /></div>
|
||||
<div class="col-sm-8"><input type="search" name="Filter.Search" id="ifFilterSearch" class="FilterSearch sax-input" maxlength="64" /></div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -73,13 +73,12 @@ else
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12"><div class="ActivityBlurb"></div></div>
|
||||
<div class="col-sm-6">
|
||||
<div class="sax-note">
|
||||
<span class="ActivitySport"></span> - <span class="ActivityRegion"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 right"><div class="sax-note ActivityPublished">@Localiser["label.published"]: <span class="ActivityPublishedOn"></span></div></div>
|
||||
<div class="col-sm"><div class="ActivityBlurb"></div></div>
|
||||
<div class="fixed"><div class="sax-note ActivityAuthor"></div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm"><div class="sax-note"><span class="ActivitySport"></span> - <span class="ActivityRegion"></span></div></div>
|
||||
<div class="fixed"><div class="sax-note ActivityPublished">@Localiser["label.published"]: <span class="ActivityPublishedOn"></span></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -44,12 +44,13 @@
|
||||
let item = activity.item;
|
||||
let $item = activity.$item;
|
||||
if (!item) return;
|
||||
$item.addClass(item.itemTypeClass);//.toggleClass('sax-activity-reaction-' + item.reaction, !!item.reaction);
|
||||
$item.addClass(item.itemTypeClass);
|
||||
sax.refreshItemReaction(activity);
|
||||
$('.ActivityOrganisation', $item).text(item.organisation);
|
||||
$('.ActivityAuthor', $item).text(item.author);
|
||||
$('.ActivityCaption', $item).text(item.caption);
|
||||
$('.ActivityBlurb', $item).text(item.blurb);
|
||||
$('.ActivityAuthor', $item).text(item.author);
|
||||
$('.ActivitySport', $item).text(item.sport);
|
||||
$('.ActivityRegion', $item).text(item.region);
|
||||
$('.ActivityPublishedOn', $item).text(item.publishedOnFmt);
|
||||
@@ -173,6 +174,7 @@
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
sax.$pnl.filter = $('.sax-panel-filter').on('input', '#ifFilterSearch', function () { sax.refreshResults(500) });
|
||||
sax.$pnl.results = $('.sax-panel-results');
|
||||
|
||||
var opt = sax.dlgOpts();
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.2.5.0";
|
||||
private static String version { get; } = "1.2.5.1";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -42,6 +42,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// 1.2.5 20-Apr-2022 Article feedback
|
||||
// - Online Activity/Article feedback 5 stars, summary on Article list/popup.
|
||||
// - Online Activity filter.
|
||||
// - Admin - User - Sports listed.
|
||||
// 1.2.4 3-Mar-2022 View own articles.
|
||||
// - Online Home page lists own articlesregardless of sport/region.
|
||||
|
||||
Reference in New Issue
Block a user