Closed bezhanSalleh closed 1 week ago
Updated Property Type for $previous
in FilamentGoogleAnalytics
The code has been adjusted so that this property now has a more versatile type, allowing it to represent whole numbers or floating point values rather than just textual data, and setting its default value to 0
.
Adjusted the Constructor and Method Signatures They now accept and produce whole numbers or floating point values, which offers greater flexibility compared to working with just textual data.
Rewrote compute
Method in FilamentGoogleAnalytics
The logic of this method is now simpler and more understandable thanks to the use of a feature called "match expressions" to handle different scenarios.
Improved trajectoryDescription
Method in FilamentGoogleAnalytics
String concatenation in this method has been improved to make it clearer and better structured.
Introduced Use of OrderBy
in MetricDiff
Trait
This inclusion allows the analytics results to be sorted based on their dimensions, improving data organization and potentially making analysis easier.
Optimized sessionsToday
Method in Sessions
Trait
This method now employs "match expressions" for different result conditions, simplifying its logic and making the code cleaner to read and understand.
Fine-Tuned Return Values in sessionDurationToday
Method in SessionsDuration
Trait
Edge cases are now handled more efficiently in this method using "match expressions" to cover all unexpected scenarios, boosting the robustness of the system.
Refined Order of Assigning previous
and result
in Certain Methods
The assignment sequence in the sessionsYesterday
and sessionDurationYesterday
methods is adjusted to align better with the newly introduced logic, making the overall workflow more consistent.
This pull request includes several changes to improve type safety, refactor methods, and enhance data retrieval ordering in the
FilamentGoogleAnalytics
class and related traits.Type Safety and Refactoring:
src/FilamentGoogleAnalytics.php
: Updated theprevious
andvalue
properties to acceptint
orfloat
types and provided default values. Refactored methods to use these types.src/FilamentGoogleAnalytics.php
: Refactored thecompute
method to use amatch
expression for cleaner and more readable logic.Data Retrieval and Ordering:
src/Traits/MetricDiff.php
: AddedOrderBy
to the imports and updated theget
method to include ordering by dimensions. [1] [2]Session Data Handling:
src/Traits/Sessions.php
: Refactored thesessionsToday
method to use amatch
expression for better handling of different scenarios.src/Traits/SessionsDuration.php
: Refactored thesessionDurationToday
method to use amatch
expression for better handling of different scenarios.