Skip to content

Commit

Permalink
Merge pull request #1494 from xibosignage/develop
Browse files Browse the repository at this point in the history
3.3.0 final release testing fixes
  • Loading branch information
dasgarner authored Nov 8, 2022
2 parents 15dd9e1 + 292e80f commit aec4d4e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/Connector/XiboSspConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function getAvailablePartners(bool $isThrowError = false, ?string $withAp
} else {
$apiKey = $this->getSetting('apiKey');
if (empty($apiKey)) {
return null;
return [];
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Factory/CampaignFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function query($sortOrder = null, $filterBy = [])
$params['campaignId'] = $sanitizedFilter->getInt('campaignId', ['default' => 0]);
}

if ($sanitizedFilter->getString('type') !== null) {
if ($sanitizedFilter->getString('type') != null) {
$body .= ' AND campaign.type = :type ';
$params['type'] = $sanitizedFilter->getString('type');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Helper/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function migrationPending()
if (self::isDevMode()) {
return self::getMigrationStatus() > 2;
} else {
self::getMigrationStatus() != 0;
return self::getMigrationStatus() != 0;
}
}

Expand Down
14 changes: 12 additions & 2 deletions lib/Storage/MongoDbTimeSeriesStore.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (C) 2019 Xibo Signage Ltd
/*
* Copyright (C) 2022 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand All @@ -27,6 +27,7 @@
use MongoDB\BSON\Regex;
use MongoDB\BSON\UTCDateTime;
use MongoDB\Client;
use Xibo\Entity\Campaign;
use Xibo\Factory\CampaignFactory;
use Xibo\Factory\DisplayFactory;
use Xibo\Factory\DisplayGroupFactory;
Expand Down Expand Up @@ -368,6 +369,15 @@ public function addStat($statData)
// TagFilter array
$statData['tagFilter'] = $tagFilter;

// Parent Campaign
if (array_key_exists('parentCampaign', $statData)) {
if ($statData['parentCampaign'] instanceof Campaign) {
$statData['parentCampaign'] = $statData['parentCampaign']->campaign;
} else {
$statData['parentCampaign'] = '';
}
}

$this->stats[] = $statData;
}

Expand Down
13 changes: 11 additions & 2 deletions lib/Xmds/Soap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1760,9 +1760,18 @@ protected function doSubmitStats($serverKey, $hardwareKey, $statXml)
}

if ($campaigns[$parentCampaignId]->type === 'ad') {
// TODO: spend/impressions multiplier for this display
$parentCampaign = $campaigns[$parentCampaignId];
$parentCampaign->incrementPlays($count, 0, 1);

// spend/impressions multiplier for this display
$spend = empty($this->display->costPerPlay)
? 0
: ($count * $this->display->costPerPlay);
$impressions = empty($this->display->impressionsPerPlay)
? 0
: ($count * $this->display->impressionsPerPlay);

// record
$parentCampaign->incrementPlays($count, $spend, $impressions);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions views/campaign-page.twig
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
{% if currentUser.featureEnabled('ad.campaign') %}
{% set title %}{% trans "Type" %}{% endset %}
{% set options = [
{ id: null, name: "" },
{ id: "list", name: "Layout list"|trans },
{ id: "ad", name: "Ad Campaign"|trans }
] %}
Expand Down

0 comments on commit aec4d4e

Please sign in to comment.