Skip to content

Commit f5bfd9d

Browse files
authored
Merge pull request #6479 from Countly/crash-stats
[SER-2499] [crashes] Fix trend and change calculation
2 parents b81f88d + 6d88fca commit f5bfd9d

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Fixes:
88
- [core] Use correct rights validation for loyality
99
- [crashes] Fix free session for home widget
1010
- [crashes] Use na for free session and free user when there's no data
11+
- [crashes] Fix trend and change calculation for crash stats
1112

1213
Enterprise Fixes:
1314
- [ldap] Error handling in ldap plugin on search error

plugins/crashes/frontend/public/javascripts/countly.models.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,18 @@ function transformAppVersion(inpVersion) {
169169
else if (dashboard[metric].total !== 0 && dashboard[metric]["prev-total"] === 0) {
170170
dashboard[metric].change = "∞";
171171
}
172+
else if (dashboard[metric].total === dashboard[metric]["prev-total"]) {
173+
dashboard[metric].change = "0";
174+
}
172175

173176
if (dashboard[metric].total === dashboard[metric]["prev-total"]) {
174177
dashboard[metric].trend = "n";
175178
}
176179
else {
177-
dashboard[metric].trend = dashboard[metric].total >= dashboard[metric]["prev-total"] ? "u" : "d";
180+
var totl = dashboard[metric].total === 'NA' ? -1 : dashboard[metric].total;
181+
var prevTotl = dashboard[metric]['prev-total'] === 'NA' ? -1 : dashboard[metric]['prev-total'];
182+
183+
dashboard[metric].trend = totl >= prevTotl ? 'u' : 'd';
178184
}
179185

180186
if (metric in derivations) {

ui-tests/cypress/lib/dashboard/crashes/crashes.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ const verifyCrashStatisticsEChartElements = ({
563563

564564
cy.verifyElement({
565565
labelElement: crashStatisticsEChartElements.TOTAL_OCCURENCES_CHANGE_VALUE_LABEL,
566-
labelText: "NA",
566+
labelText: "0",
567567
});
568568

569569
cy.verifyElement({
@@ -573,7 +573,7 @@ const verifyCrashStatisticsEChartElements = ({
573573

574574
cy.verifyElement({
575575
labelElement: crashStatisticsEChartElements.TOTAL_OCCURENCES_CHANGE_VALUE_LABEL,
576-
labelText: "NA",
576+
labelText: "0",
577577
});
578578

579579
cy.verifyElement({
@@ -583,22 +583,22 @@ const verifyCrashStatisticsEChartElements = ({
583583

584584
cy.verifyElement({
585585
labelElement: crashStatisticsEChartElements.CRASH_FREE_USERS_NUMBER_LABEL,
586-
labelText: "100.00%",
586+
labelText: "NA",
587587
});
588588

589589
cy.verifyElement({
590590
labelElement: crashStatisticsEChartElements.CRASH_FREE_USERS_CHANGE_VALUE_LABEL,
591-
labelText: "0.0%",
591+
labelText: "NA",
592592
});
593593

594594
cy.verifyElement({
595595
labelElement: crashStatisticsEChartElements.CRASH_FREE_SESSIONS_NUMBER_LABEL,
596-
labelText: "100.00%",
596+
labelText: "NA",
597597
});
598598

599599
cy.verifyElement({
600600
labelElement: crashStatisticsEChartElements.CRASH_FREE_SESSIONS_CHANGE_VALUE_LABEL,
601-
labelText: "0.0%",
601+
labelText: "NA",
602602
});
603603
return;
604604
}
@@ -686,4 +686,4 @@ module.exports = {
686686
verifyCrashGroupsDataFromTable,
687687
verifyCrashStatisticsMetricCard,
688688
verifyCrashStatisticsEChartElements
689-
};
689+
};

ui-tests/cypress/lib/dashboard/home/home.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ const verifyEmptyPageElements = () => {
484484

485485
cy.verifyElement({
486486
element: homePageElements.CRASH_STATISTICS.TOTAL_CRASHES_TREND_VALUE,
487-
elementText: "NA",
487+
elementText: "0",
488488
});
489489

490490
cy.verifyElement({
@@ -498,7 +498,7 @@ const verifyEmptyPageElements = () => {
498498

499499
cy.verifyElement({
500500
element: homePageElements.CRASH_STATISTICS.UNIQUE_CRASHES_TREND_VALUE,
501-
elementText: "NA",
501+
elementText: "0",
502502
});
503503

504504
cy.verifyElement({
@@ -512,7 +512,7 @@ const verifyEmptyPageElements = () => {
512512

513513
cy.verifyElement({
514514
element: homePageElements.CRASH_STATISTICS.CRASH_FREE_USERS_NUMBER,
515-
elementText: "100.00%",
515+
elementText: "NA",
516516
});
517517

518518
cy.verifyElement({
@@ -521,12 +521,12 @@ const verifyEmptyPageElements = () => {
521521

522522
cy.verifyElement({
523523
element: homePageElements.CRASH_STATISTICS.CRASH_FREE_USERS_TREND_VALUE,
524-
elementText: "0.0%",
524+
elementText: "NA",
525525
});
526526

527527
cy.verifyElement({
528528
element: homePageElements.CRASH_STATISTICS.CRASH_FREE_SESSIONS_NUMBER,
529-
elementText: "100.00%",
529+
elementText: "NA",
530530
});
531531

532532
cy.verifyElement({
@@ -535,7 +535,7 @@ const verifyEmptyPageElements = () => {
535535

536536
cy.verifyElement({
537537
element: homePageElements.CRASH_STATISTICS.CRASH_FREE_SESSIONS_TREND_VALUE,
538-
elementText: "0.0%",
538+
elementText: "NA",
539539
});
540540
};
541541

@@ -806,4 +806,4 @@ const verifyFullDataPageElements = () => {
806806
module.exports = {
807807
verifyEmptyPageElements,
808808
verifyFullDataPageElements
809-
};
809+
};

0 commit comments

Comments
 (0)