=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===
This commit is contained in:
@@ -16,6 +16,7 @@ namespace adas_core.Application.Subscriptions;
|
||||
/// <summary>
|
||||
/// Represents a grouped WebSocket subscriber that aggregates and manages multiple related subscription registrations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fe6f386 -->
|
||||
public class WsSubscriberGrouped
|
||||
{
|
||||
private readonly EventHandler<string> _sendEvent;
|
||||
@@ -30,6 +31,8 @@ public class WsSubscriberGrouped
|
||||
/// <param name="lastGroupedObservationObs">The most recent <see cref="GroupedObservation"/> passed to <see cref="UpdateLastGo"/> to initialize the last-observation state.</param>
|
||||
/// <param name="sendEvent">The <see cref="EventHandler{String}"/> invoked by the timer to forward outgoing messages to the subscriber.</param>
|
||||
/// <!-- aidoc:v1 sig=16f9dfc body=cc103b1 -->
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "Summary states the constructor 'starts the internal Timer', but Timer.Start() is only invoked when Regularity is not GroupedObservationEnum.Regularity.Times; in the 'Times' regularity case the timer is configured but not started." -->
|
||||
public WsSubscriberGrouped(ObjectId patientId, string wsId, string? timeZoneId,
|
||||
GroupedField gf, GroupedObservation lastGroupedObservationObs, EventHandler<string> sendEvent)
|
||||
{
|
||||
@@ -74,6 +77,7 @@ public class WsSubscriberGrouped
|
||||
/// Refreshes the cached last observations by matching each known name against the supplied grouped observation, falling back to the most recent observation when no match is found.
|
||||
/// </summary>
|
||||
/// <param name="lastGroupedObservationObs">The source grouped observation whose observations are searched to populate the last-observation cache.</param>
|
||||
/// <!-- aidoc:v1 sig=9a3db7f body=189f23b -->
|
||||
public void UpdateLastGo(GroupedObservation lastGroupedObservationObs)
|
||||
{
|
||||
LastGroupedObservationObs.Clear();
|
||||
@@ -150,6 +154,7 @@ public class WsSubscriberGrouped
|
||||
/// <summary>
|
||||
/// Restarts the timer by recalculating its interval through <c>SetUpTimerInterval</c> and then starting it.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a307365 body=43d12e3 -->
|
||||
private void TimerReestart()
|
||||
{
|
||||
Timer.Interval = SetUpTimerInterval();
|
||||
@@ -160,6 +165,7 @@ public class WsSubscriberGrouped
|
||||
/// Calculates the timer interval in milliseconds until the next scheduled occurrence based on the configured <see cref="Regularity"/>, supporting Second, Minute, Day, and a default (Hour) case, and adds a per-regularity grace time.
|
||||
/// </summary>
|
||||
/// <returns>The number of milliseconds to wait until the next interval, including the grace time.</returns>
|
||||
/// <!-- aidoc:v1 sig=e8a752a body=602d58e -->
|
||||
private int SetUpTimerInterval()
|
||||
{
|
||||
var currentDateTime = DateTime.Now;
|
||||
@@ -230,6 +236,7 @@ public class WsSubscriberGrouped
|
||||
/// <summary>
|
||||
/// Provides static extension methods to enhance WebSocket subscriber functionality.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1808a25 -->
|
||||
public static class WsSubscriberExtension
|
||||
{
|
||||
/// <summary>
|
||||
@@ -239,6 +246,7 @@ public static class WsSubscriberExtension
|
||||
/// <param name="r">The <see cref="GroupedField"/> to compare against the source.</param>
|
||||
/// <param name="patientId">The patient identifier to match against the source patient identifier.</param>
|
||||
/// <returns><c>true</c> if all compared properties are equal; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=d3fad4a body=13fa9d8 -->
|
||||
public static bool Compare(this WsSubscriberGrouped source, GroupedField r, ObjectId patientId)
|
||||
{
|
||||
return r.Regularity == source.Regularity &&
|
||||
@@ -256,6 +264,7 @@ public static class WsSubscriberExtension
|
||||
/// <param name="shift">The target shift list to compare.</param>
|
||||
/// <param name="sourceShift">The source shift list to compare against.</param>
|
||||
/// <returns><c>true</c> if both lists are null or if their sequence of strings is equal; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=71a6e44 body=3a82a4f -->
|
||||
private static bool CompareStringShiftList(List<string>? shift, List<string>? sourceShift)
|
||||
{
|
||||
if (shift != null && sourceShift != null) return sourceShift.SequenceEqual(shift);
|
||||
@@ -271,6 +280,7 @@ public static class WsSubscriberExtension
|
||||
/// <param name="name">The fallback candidate list of names to compare against <paramref name="sourceNames"/> when <paramref name="names"/> cannot be used.</param>
|
||||
/// <param name="sourceNames">The source list of names being compared.</param>
|
||||
/// <returns><c>true</c> if <paramref name="sourceNames"/> is a sequence match for either <paramref name="names"/> or <paramref name="name"/>; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=96b8c77 body=49d77d4 -->
|
||||
private static bool CompareNamesStringList(List<string> names, List<string> name, List<string> sourceNames)
|
||||
{
|
||||
if (!CollectionsUtils.IsEmptyOrNull(names) && sourceNames.SequenceEqual(names)) return true;
|
||||
@@ -281,6 +291,8 @@ public static class WsSubscriberExtension
|
||||
/// Check if the incoming observation affect to the group and is new info or is irrelevant
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=missing_returns
|
||||
/// "The <returns> tag is present but contains no description; the reader cannot tell what true vs false means without reading the implementation" -->
|
||||
public static bool IsNewObservationRelevantForGroup(this WsSubscriberGrouped group, PatientObservation obs)
|
||||
{
|
||||
double.TryParse(obs.Value.ToString(), out var pobsValue);
|
||||
|
||||
Reference in New Issue
Block a user