add DateTime property variant for CompletedAt
This commit is contained in:
		
							parent
							
								
									bf43262a8e
								
							
						
					
					
						commit
						a3b54b1326
					
				@ -21,12 +21,12 @@ public class InfluenceSupport : Transaction {
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public MissionAcceptedEntry? AcceptedEntry { get; set; }
 | 
			
		||||
 | 
			
		||||
    public override string CompletedAt {
 | 
			
		||||
    public override DateTime? CompletedAtDateTime {
 | 
			
		||||
        get { 
 | 
			
		||||
            if (RelevantMission == null) {
 | 
			
		||||
                return "";
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
            return RelevantMission.Timestamp.ToString("dd.MM.yyyy hh:mm UTC"); 
 | 
			
		||||
            return RelevantMission.Timestamp; 
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -11,12 +11,12 @@ public class MissionCompleted : Transaction {
 | 
			
		||||
 | 
			
		||||
    public MissionCompleted() { }
 | 
			
		||||
 | 
			
		||||
    public override string CompletedAt {
 | 
			
		||||
    public override DateTime? CompletedAtDateTime {
 | 
			
		||||
        get {
 | 
			
		||||
            if (CompletedEntry == null) {
 | 
			
		||||
                return "";
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
            return CompletedEntry.Timestamp.ToString("dd.MM.yyyy HH:mm UTC");
 | 
			
		||||
            return CompletedEntry.Timestamp;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,9 +1,4 @@
 | 
			
		||||
using EDPlayerJournal.Entries;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace EDPlayerJournal.BGS;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -6,18 +6,29 @@ namespace EDPlayerJournal.BGS;
 | 
			
		||||
public class Transaction : IComparable<Transaction> {
 | 
			
		||||
    public List<Entry> Entries { get; } = new List<Entry>();
 | 
			
		||||
 | 
			
		||||
    public virtual string CompletedAt {
 | 
			
		||||
    public string CompletedAt {
 | 
			
		||||
        get {
 | 
			
		||||
            DateTime? datetime = CompletedAtDateTime;
 | 
			
		||||
            if (datetime == null) {
 | 
			
		||||
                return "Unknown";
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return datetime.Value.ToString("dd.MM.yyyy HH:mm UTC");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public virtual DateTime? CompletedAtDateTime {
 | 
			
		||||
        get {
 | 
			
		||||
            var items = Entries
 | 
			
		||||
                .OrderBy(x => x.Timestamp)
 | 
			
		||||
                .ToArray()
 | 
			
		||||
                ;
 | 
			
		||||
            if (items == null || items.Length == 0) {
 | 
			
		||||
                return "Unknown";
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Entry last = items.Last();
 | 
			
		||||
            return last.Timestamp.ToString("dd.MM.yyyy HH:mm UTC");
 | 
			
		||||
            return last.Timestamp;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user