MCPcopy Create free account
hub / github.com/aptabase/aptabase / CloneToPreviousInterval

Method CloneToPreviousInterval

src/Features/Stats/StatsController.cs:135–163  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

133 public string? AppVersion { get; set; }
134
135 public QueryArgs CloneToPreviousInterval()
136 {
137 if (!DateFrom.HasValue || !DateTo.HasValue)
138 {
139 return this;
140 }
141
142 var previousEnd = DateFrom.Value;
143 // Go back 1 second so that when relativeTo is 00:00:00 we start with the previous day
144 // Happens when looking for previous period and "period" is "month" or "last-month"
145 if (previousEnd.TimeOfDay == TimeSpan.Zero)
146 previousEnd = previousEnd.AddSeconds(-1);
147 var previousStart =
148 DateFrom.Value.Subtract(
149 DateTo.Value.Subtract((DateFrom.Value))); //start - (end - start)
150
151 return new QueryArgs
152 {
153 AppId = AppId,
154 SessionId = SessionId,
155 DateFrom = previousStart,
156 DateTo = previousEnd,
157 Granularity = Granularity,
158 CountryCode = CountryCode,
159 OsName = OsName,
160 EventName = EventName,
161 AppVersion = AppVersion,
162 };
163 }
164}
165
166public class QueryParams

Callers 1

KeyMetricsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected