Skip to content

Commit c588843

Browse files
committed
Corrected error (regression tests)
1 parent 1b9803c commit c588843

File tree

13 files changed

+55
-28
lines changed

13 files changed

+55
-28
lines changed

src/Server/Coderr.Server.ReportAnalyzer/Incidents/IncidentBeingAnalyzed.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public string Description
9393
}
9494

9595
/// <summary>
96-
/// List of all environment names that the developer specified when reporting the errors.
96+
/// List of all environment names that the developer specified when reporting the errors.
9797
/// </summary>
9898
public string[] EnvironmentNames { get; set; }
9999

@@ -139,13 +139,19 @@ public string Description
139139
public bool IsReOpened { get; set; }
140140

141141
/// <summary>
142-
/// When we received a report (just to keep track of how fresh this incident is).
142+
/// When we received a report (just to keep track of how fresh this incident is).
143143
/// </summary>
144144
public DateTime LastReportAtUtc { get; set; }
145145

146146
/// <summary>
147-
/// When we received a report that we stored.
147+
/// When we received a report that we actual stored.
148148
/// </summary>
149+
/// <remarks>
150+
/// <para>
151+
/// This field is used to determine if we should store another report today, while <see cref="LastReportAtUtc" />
152+
/// is just used to keep track of when we received the most recent report.
153+
/// </para>
154+
/// </remarks>
149155
public DateTime LastStoredReportUtc { get; set; }
150156

151157
/// <summary>
@@ -204,10 +210,7 @@ public void AddReport(ErrorReportEntity entity)
204210
StackTrace = entity.Exception.StackTrace;
205211
}
206212

207-
if (LastReportAtUtc < entity.CreatedAtUtc)
208-
LastReportAtUtc = entity.CreatedAtUtc;
209-
210-
213+
LastReportAtUtc = entity.CreatedAtUtc;
211214
ReportCount++;
212215
}
213216

src/Server/Coderr.Server.ReportAnalyzer/UserNotifications/Handlers/CheckForNotificationsToSend.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public async Task HandleAsync(IMessageContext context, ReportAddedToIncident e)
5656
{
5757
if (setting.NewIncident != NotificationState.Disabled && e.IsNewIncident == true)
5858
{
59-
if (e.EnvironmentName.Equals("production", StringComparison.OrdinalIgnoreCase) ||
60-
e.EnvironmentName.Equals("prod", StringComparison.OrdinalIgnoreCase)
61-
|| string.IsNullOrEmpty(e.EnvironmentName))
59+
if (string.IsNullOrEmpty(e.EnvironmentName)
60+
|| e.EnvironmentName.Equals("production", StringComparison.OrdinalIgnoreCase)
61+
|| e.EnvironmentName.Equals("prod", StringComparison.OrdinalIgnoreCase))
6262
{
6363
await CreateNotification(context, e, setting.AccountId, setting.NewIncident);
6464
}

src/Server/Coderr.Server.ReportAnalyzer/UserNotifications/NotificationService.cs renamed to src/Server/Coderr.Server.SqlServer/Core/Notifications/NotificationService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Coderr.Server.ReportAnalyzer.UserNotifications
99
{
10+
// Must be here so that it can be used from both queues.
1011
/// <summary>
1112
/// Implementation of <see cref="INotificationService"/>.
1213
/// </summary>

src/Server/Coderr.Server.SqlServer/Modules/Versions/Queries/GetApplicationVersionsHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public async Task<GetApplicationVersionsResult> HandleAsync(IMessageContext cont
2323
{
2424
var sql =
2525
@"SELECT version, sum(incidentcount) incidentcount, sum(reportcount) reportcount, min(FirstReportDate) as FirstReportDate, max(LastReportDate)as LastReportDate
26-
FROM ApplicationVersions
27-
join ApplicationVersionMonths on (versionid=applicationversions.id)
26+
FROM ApplicationVersions WITH (NoLock)
27+
join ApplicationVersionMonths WITH (NoLock) on (versionid=applicationversions.id)
2828
where applicationid=@appId
2929
group by version
3030
order by version

src/Server/Coderr.Server.SqlServer/ReportAnalyzer/AnalyticsRepository.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,16 @@ public void CreateIncident(IncidentBeingAnalyzed incident)
7171
if (string.IsNullOrEmpty(incident.ReportHashCode))
7272
throw new InvalidOperationException("ReportHashCode is required to be able to detect duplicates");
7373

74+
if (incident.LastReportAtUtc == DateTime.MinValue)
75+
incident.LastReportAtUtc = DateTime.UtcNow;
76+
if (incident.LastStoredReportUtc == DateTime.MinValue)
77+
incident.LastStoredReportUtc = DateTime.UtcNow;
78+
7479
using (var cmd = _unitOfWork.CreateCommand())
7580
{
7681
cmd.CommandText =
77-
"INSERT INTO Incidents (ReportHashCode, ApplicationId, CreatedAtUtc, HashCodeIdentifier, StackTrace, ReportCount, UpdatedAtUtc, Description, FullName, IsReOpened, LastReportAtUtc)" +
78-
" VALUES (@ReportHashCode, @ApplicationId, @CreatedAtUtc, @HashCodeIdentifier, @StackTrace, @ReportCount, @UpdatedAtUtc, @Description, @FullName, 0, @LastReportAtUtc);select SCOPE_IDENTITY();";
82+
"INSERT INTO Incidents (ReportHashCode, ApplicationId, CreatedAtUtc, HashCodeIdentifier, StackTrace, ReportCount, UpdatedAtUtc, Description, FullName, IsReOpened, LastStoredReportUtc, LastReportAtUtc)" +
83+
" VALUES (@ReportHashCode, @ApplicationId, @CreatedAtUtc, @HashCodeIdentifier, @StackTrace, @ReportCount, @UpdatedAtUtc, @Description, @FullName, 0, @LastStoredReportUtc, @LastReportAtUtc);select SCOPE_IDENTITY();";
7984
cmd.AddParameter("Id", incident.Id);
8085
cmd.AddParameter("ReportHashCode", incident.ReportHashCode);
8186
cmd.AddParameter("ApplicationId", incident.ApplicationId);
@@ -86,6 +91,7 @@ public void CreateIncident(IncidentBeingAnalyzed incident)
8691
cmd.AddParameter("Description", incident.Description);
8792
cmd.AddParameter("StackTrace", incident.StackTrace);
8893
cmd.AddParameter("FullName", incident.FullName);
94+
cmd.AddParameter("LastStoredReportUtc", incident.LastStoredReportUtc);
8995
cmd.AddParameter("LastReportAtUtc", incident.LastReportAtUtc);
9096
var id = (int) (decimal) cmd.ExecuteScalar();
9197
incident.GetType()

src/Server/Coderr.Server.Web/ClientApp/components/discover/application/configure.vue.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ <h5>
4646
</div>
4747
</div>
4848
<div class="card-footer">
49-
<button class="btn btn-blue" v-on:click.prevent="completedConfiguration">Configuration is complete &gt;&gt;</button>
49+
<button class="btn btn-blue" id="config-complete-button" v-on:click.prevent="completedConfiguration">Configuration is complete &gt;&gt;</button>
5050
</div>
5151
</div>
5252
</div>

src/Server/Coderr.Server.Web/ClientApp/components/discover/home/home.vue.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<router-link class="btn btn-primary btn-sm" v-bind:click="assignBestToMe">{{myBestSuggestion.Description}}</router-link>
5252
</div>
5353
<div class="card">
54-
<div class="card-header">
54+
<div class="card-header" id="chart-summary-header">
5555
<span v-if="applicationId == 0">Incident trend per application</span>
5656
<span v-else>Incident trend</span>
5757
</div>

src/Server/Coderr.Server.Web/ClientApp/components/home/navmenu/navmenu.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default class NavMenuComponent extends Vue {
4040
this.myApplicationsPromise = new Promise((accept, reject) => {
4141
AppRoot.Instance.loadCurrentUser().then(x => {
4242
this.allApps = x.applications;
43+
this.myApplications = x.applications;
4344
accept();
4445
});
4546
});

src/Server/Coderr.Server.Web/ClientApp/components/home/navmenu/navmenu.vue.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<a v-on:click.prevent="changeApplication(null)" class="dropdown-item"><i class="fa fa-home"></i> All applications</a>
2525
<div class="dropdown-divider"></div>
2626
<div v-for="item in myApplications">
27-
<a href="#" v-on:click.prevent="changeApplication(item.tag)" class="dropdown-item text-black-50"><i class="fa-desktop fa"></i> {{item.title}}</a>
27+
<a href="#" v-on:click.prevent="changeApplication(item.id)" class="dropdown-item text-black-50"><i class="fa-desktop fa"></i> {{item.name}}</a>
2828
</div>
2929
</div>
3030
</li>

src/Tools/Coderr.IntegrationTests/Coderr.IntegrationTests/Entities/IncidentWrapper.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,12 @@ async Task<bool> Func()
168168

169169
public async Task UpdateByLastReceivedReport(Func<GetIncidentResult, bool> filter = null)
170170
{
171-
await Update(x => x.LastReportReceivedAtUtc > DTO.LastReportReceivedAtUtc);
171+
await Update(x =>
172+
{
173+
Console.WriteLine(
174+
$"Comparing our {DTO.LastReportReceivedAtUtc:yyyyMMdd hh:mm:ss.fff} with server {x.LastReportReceivedAtUtc:yyyyMMdd hh:mm:ss.fff}");
175+
return x.LastReportReceivedAtUtc > DTO.LastReportReceivedAtUtc;
176+
});
172177
}
173178
}
174179
}

0 commit comments

Comments
 (0)