New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to change periods over which evolution graphs display in scheduled reports #13501
Conversation
… to control lastN used in ImageGraph evolution.
Can we move this to 3.7.0 maybe? |
It's required for a cloud report, so if moved to 3.7.0, then we'd have to wait until 3.7.0 before it can be used. CC @mattab |
8f7d046
to
60470f3
Compare
plugins/ImageGraph/ImageGraph.php
Outdated
|
||
public static function getDefaultGraphEvolutionLastPeriods() | ||
{ | ||
$lastPeriods = Config::getInstance()->General['graphs_default_evolution_graph_last_days_amount']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we maybe fail if someone configures a value <= 0? so the user can see it was not correctly changed? not needed though...
plugins/ScheduledReports/API.php
Outdated
@@ -86,18 +87,22 @@ public function __construct(LoggerInterface $logger) | |||
* @param array $reports array of reports | |||
* @param array $parameters array of parameters | |||
* @param bool|int $idSegment Segment Identifier | |||
* @param bool $evolutionPeriodFor If true, evolution graphs cover each day within the period. If false, evolution graphs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not quite understanding the difference between the two but reckon will get more clear once having a look at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$evolutionPeriodFor
determines if looking within range or using lastN value. I originally only had one parameter $evolutionPeriodLastN
where if it was <= 0, it would look at days within the range, but that's not really clear w/ just one parameter, so I opted for being explicit.
plugins/ScheduledReports/API.php
Outdated
$originalShowEvolutionWithinSelectedPeriod = Config::getInstance()->General['graphs_show_evolution_within_selected_period']; | ||
$originalDefaultEvolutionGraphLastPeriodsAmount = Config::getInstance()->General['graphs_default_evolution_graph_last_days_amount']; | ||
try { | ||
Config::getInstance()->General['graphs_show_evolution_within_selected_period'] = (bool)$report['evolution_graph_within_period']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested it yet but are you sure this works? I think in the past usually it was often needed to do
$general = $config->General;$general['...']=(bool)....; $config->General = $general;
. Not sure if this is still a thing...
Also I'm not sure this is actually applied... without testing or looking further I would have expected this needs to be set before calling \Piwik\Plugins\API\API::getInstance()->getReportMetadata($idSite);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember that was for specific versions of PHP. I can do that to be safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: it's used in API.getProcessedReport
, but can set it before all the API calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember that was for specific versions of PHP. I can do that to be safe.
might be good. I don't really remember why it was needed or whether it's still the case. Haven't tested to write it the normal way in a while as gotten used to it :)
|
||
<div | ||
class="row evolution-graph-period" | ||
ng-show="manageScheduledReport.report.displayFormat == '2' || manageScheduledReport.report.displayFormat == '3'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be also available for "Default) Display Report tables (Graphs only for key metrics)"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has an effect, so I added it.
@@ -53,6 +53,8 @@ | |||
"SuccessfullyUnsubscribed": "You have been successfully unsubscribed from the report %1$s.", | |||
"UnsubscribeFooter": "To unsubscribe from this report please follow this link: %1$s", | |||
"NoTokenProvided": "No token was provided in the URL", | |||
"NoSubscriptionFound": "No subscription found. Maybe the report was already unsubscribed or removed." | |||
"NoSubscriptionFound": "No subscription found. Maybe the report was already unsubscribed or removed.", | |||
"EvolutionGraphsShowForEachInPeriod": "Evolution graphs show the evolution for %1$seach day%2$s in the last %3$s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be " shows the evolution"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be 'show' since 'evolution graphs' is plural (in this case the option is for all evolution graphs in the report, which is why it's plural in the text)
@diosmosis I've just tried it and first error I got was |
@tsteur Updated the PR and fixed the issue you noticed. |
@diosmosis looks good. Be maybe great to change the config access... I reckon it be good to have a method Otherwise: I've updated to Mac OS Mojave and GD+freetype isn't working anymore so cannot test the graphs but otherwise looks good 👍 |
Ok, will merge after Config::setSetting change. |
LGTM |
Changes:
[General] graphs_default_evolution_graph_last_days_amount
to match other params.Tests don't pass just yet, need to add a new file.