Skip to content

Commit

Permalink
Changes lower case logic to DB, #PG-4087, #174
Browse files Browse the repository at this point in the history
  • Loading branch information
AltamashShaikh committed Jan 10, 2025
1 parent f6a2868 commit 6966f0f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions RecordBuilders/CampaignReporting.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ protected function aggregate(ArchiveProcessor $archiveProcessor): array
*/
protected function aggregateFromLogs(LogAggregator $logAggregator, array $records, $dimensions, $table, $aggregatorMethod): void
{
$systemSettings = StaticContainer::get(SystemSettings::class);
if (!$systemSettings->doNotChangeCaseOfUtmParameters->getValue()) {
$newDimensions = [];
foreach($dimensions as $dimension) {

Check failure on line 85 in RecordBuilders/CampaignReporting.php

View workflow job for this annotation

GitHub Actions / PHPCS

CampaignReporting.php: Expected 1 space after FOREACH keyword; 0 found
$lowerDimensionColumn = $table . '.' . $dimension;
$newDimensions[$dimension] = "LOWER($lowerDimensionColumn)";
}
$dimensions = $newDimensions;
}

$whereClause = $table . ".referer_type = " . Common::REFERRER_TYPE_CAMPAIGN;
$query = $aggregatorMethod === 'queryConversionsByDimension' && version_compare(Version::VERSION, '5.2.0-b6', '>=')
? $logAggregator->$aggregatorMethod($dimensions, $whereClause, [], [], false, false, true)
Expand Down Expand Up @@ -134,7 +144,6 @@ protected function aggregateFromLogs(LogAggregator $logAggregator, array $record

protected function getLabelFromRowDimensions(array $dimensionsAsLabel, array $row): string
{
$systemSettings = StaticContainer::get(SystemSettings::class);
$labels = [];
foreach ($dimensionsAsLabel as $dimensionLabelPart) {
if (
Expand All @@ -144,12 +153,8 @@ protected function getLabelFromRowDimensions(array $dimensionsAsLabel, array $ro
$labels[] = $row[$dimensionLabelPart];
}
}
$label = implode(Archiver::SEPARATOR_COMBINED_DIMENSIONS, $labels);
if ($label && !$systemSettings->doNotChangeCaseOfUtmParameters->getValue()) {
$label = Common::mb_strtolower($label);
}

return $label;
return implode(Archiver::SEPARATOR_COMBINED_DIMENSIONS, $labels);
}

protected function getRecordToDimensions(): array
Expand Down

0 comments on commit 6966f0f

Please sign in to comment.