Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/Apps/W1/Shopify/App/src/Base/Pages/ShpfyActivities.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,27 @@ page 30100 "Shpfy Activities"
ToolTip = 'Specifies the number of order updates that aren''t processed.';
DrillDownPageId = "Shpfy Orders";
}
field(SkippedRecords; Rec."Skipped Records")
{
ApplicationArea = All;
DrillDownPageId = "Shpfy Skipped Records";
StyleExpr = SkippedRecordsStyleTxt;
ToolTip = 'Specifies the number of records that were skipped during synchronization.';
}
field(APIErrors; Rec."API Errors")
{
ApplicationArea = All;
StyleExpr = APIErrorsStyleTxt;
ToolTip = 'Specifies the number of log entries that ended with an API error.';

trigger OnDrillDown()
var
LogEntry: Record "Shpfy Log Entry";
begin
LogEntry.SetRange("Has Error", true);
Page.Run(Page::"Shpfy Log Entries", LogEntry);
end;
}
}
}
}
Expand Down Expand Up @@ -138,6 +159,20 @@ page 30100 "Shpfy Activities"
}
}

trigger OnAfterGetRecord()
begin
Rec.CalcFields("Skipped Records", "API Errors");
if Rec."Skipped Records" > 0 then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Style}$

The new StyleExpr values are assigned from inline text literals ('Ambiguous', 'Favorable', 'Unfavorable') in OnAfterGetRecord(). These style tokens form a small contract with the page runtime, so leaving them as repeated magic strings makes typos and future drift harder to spot. Define named object-scope constants or locked labels for the allowed style values and assign those instead.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4

SkippedRecordsStyleTxt := 'Ambiguous'
else
SkippedRecordsStyleTxt := 'Favorable';

if Rec."API Errors" > 0 then
APIErrorsStyleTxt := 'Unfavorable'
else
APIErrorsStyleTxt := 'Favorable';
end;

trigger OnOpenPage()
var
Shop: Record "Shpfy Shop";
Expand All @@ -161,4 +196,7 @@ page 30100 "Shpfy Activities"
end;
end;

var
SkippedRecordsStyleTxt: Text;
APIErrorsStyleTxt: Text;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Style}$

The page file ends without a trailing newline. Add a final newline after the closing brace so the file matches normal source-file formatting conventions and avoids repeated \ No newline at end of file diff noise in future changes.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

}

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4

}
12 changes: 12 additions & 0 deletions src/Apps/W1/Shopify/App/src/Base/Tables/ShpfyCue.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ table 30100 "Shpfy Cue"
Caption = 'Unmapped Companies';
FieldClass = FlowField;
}
field(10; "Skipped Records"; Integer)
{
CalcFormula = count("Shpfy Skipped Record");
Caption = 'Skipped Records';
FieldClass = FlowField;
}
field(11; "API Errors"; Integer)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Performance}$

The new "API Errors" FlowField counts "Shpfy Log Entry" rows filtered by "Has Error" = true, but the source table (Shpfy Log Entry, table 30115) only declares Key1 on "Entry No." with no key covering "Has Error" in SumIndexFields. Per CodeCop AA0232 / this article, a FlowField's source table needs a key that covers the CalcFormula's WHERE clause fields for the platform to answer CalcFields from SIFT; without it, every CalcFields call (triggered on each page activation via RefreshOnActivate = true and explicitly in the new OnAfterGetRecord trigger) falls back to a row-by-row scan of the log table, which grows unbounded over time.

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4

{
CalcFormula = count("Shpfy Log Entry" where("Has Error" = const(true)));
Caption = 'API Errors';
FieldClass = FlowField;
}
}

keys
Expand Down
Loading