Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from SSchulze1989/release-patch-0.4.1
Browse files Browse the repository at this point in the history
Patch 0.4.1 Bugfixes
  • Loading branch information
SSchulze1989 authored Jul 31, 2020
2 parents 87e2bfa + e96e968 commit 0ef8558
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
8 changes: 6 additions & 2 deletions DataManager/ModelMapperProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,15 @@ public ModelMapperProfile(IModelCache modelCache)
.ForMember(dest => dest.IncPenaltyPoints, opt => opt.Ignore())
.ForMember(dest => dest.MultiScoringFactors, opt => opt.MapFrom((src, dest, factors) =>
{
return src.MultiScoringResults.Select(x => x.Value.ToString()).Aggregate((x, y) => x + "," + y);
if (src.MultiScoringResults.Count > 0)
return src.MultiScoringResults.Select(x => x.Value.ToString()).Aggregate((x, y) => x + "," + y);
return null;
}))
.ForMember(dest => dest.MultiScoringResults, opt => opt.MapFrom((src, dest, scorings) =>
{
return src.MultiScoringResults.Select(x => x.Key).ToArray();
if (src.MultiScoringResults.Count > 0)
return src.MultiScoringResults.Select(x => x.Key).ToArray();
return new ScoringInfo[0];
}));
CreateMap<ScoringInfoDTO, ScoringModel>()
.ConstructUsing(source => ModelCache.PutOrGetModel(new ScoringModel(source.ScoringId)))
Expand Down
2 changes: 1 addition & 1 deletion iRLeagueManager/ViewModels/CalendarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace iRLeagueManager.ViewModels
{
public class CalendarViewModel : SchedulerViewModel
{
public IEnumerable<SessionViewModel> Sessions => Schedules.Count() > 0 ? Schedules.Select(x => x.Sessions.AsEnumerable()).Aggregate((x, y) => x.Concat(y)) : new SessionViewModel[0];
public IEnumerable<SessionViewModel> Sessions => Schedules.Count() > 0 ? Schedules.SelectMany(x => x.Sessions).OrderBy(x => x.Date).ToList() : new List<SessionViewModel>();
public IEnumerable<SessionViewModel> Races => Sessions.Where(x => x.SessionType == Enums.SessionType.Race);

public SessionViewModel NextRace => Races.FirstOrDefault(x => x.FullDate.Date.Add(x.RaceEnd).CompareTo(DateTime.Now) > 0);
Expand Down
13 changes: 13 additions & 0 deletions iRLeagueManager/ViewModels/ReviewCommentViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Runtime.CompilerServices;

namespace iRLeagueManager.ViewModels
{
Expand Down Expand Up @@ -87,6 +88,18 @@ public async override void SaveChanges()

public ReviewCommentViewModel(ReviewCommentModel comment) : base(comment) { }

protected override void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
switch(propertyName)
{
case nameof(Model.CommentReviewVotes):
base.OnPropertyChanged(nameof(Votes));
break;
}

base.OnPropertyChanged(propertyName);
}

public new ReviewCommentModel GetSource()
{
return base.GetSource() as ReviewCommentModel;
Expand Down

0 comments on commit 0ef8558

Please sign in to comment.