Explorar o código

Fixed notification description for schedule events.

Kenric Nugteren hai 6 meses
pai
achega
1ffea72845
Modificáronse 2 ficheiros con 6 adicións e 4 borrados
  1. 1 1
      prs.stores/Events/Event.cs
  2. 5 3
      prs.stores/Events/ScheduledEvent.cs

+ 1 - 1
prs.stores/Events/Event.cs

@@ -517,7 +517,7 @@ public static class EventUtils
             var eventData = (ev.EventData as EventData<ScheduledEvent, ScheduledEventDataModel>)!;
             if (CheckEventSchedule(eventData.Event))
             {
-                var model = new ScheduledEventDataModel();
+                var model = new ScheduledEventDataModel(ev.Event);
                 eventData.Event.Init(store, eventData, model);
                 Run(store, ev.Event, eventData, model);
 

+ 5 - 3
prs.stores/Events/ScheduledEvent.cs

@@ -114,8 +114,8 @@ public class ScheduledEvent : IEvent<ScheduledEventDataModel>, IPropertiesEvent<
     public Notification GenerateNotification(ScheduledEventDataModel model)
     {
         var notification = new Notification();
-        notification.Title = $"Schedule has run.";
-        notification.Description = $"Schedule has run.";
+        notification.Title = $"Scheduled event {model.Event.Code}: {model.Event.Description} has run.";
+        notification.Description = $"Scheduled event {model.Event.Code}: {model.Event.Description} has run.";
         return notification;
     }
 
@@ -147,8 +147,10 @@ public class ScheduledEventDataModelDefinition : IEventDataModelDefinition
     }
 }
 
-public class ScheduledEventDataModel : IEventDataModel
+public class ScheduledEventDataModel(Event ev) : IEventDataModel
 {
+    public Event Event { get; set; } = ev;
+
     public bool TryGetVariable(string name, out object? value)
     {
         value = null;