Skip to content
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

Add more date segments: visitEndServerDate visitEndServerDayOfMonth visitEndServerDayOfWeek visitEndServerDayOfYear, etc. #12521

Merged
merged 10 commits into from Feb 19, 2018

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Jan 30, 2018

Adds the following new date segments (and dimensions basically):

  • visitEndServerDate
  • visitEndServerDayOfMonth
  • visitEndServerDayOfWeek
  • visitEndServerDayOfYear
  • visitEndServerMonth
  • visitEndServerQuarter
  • visitEndServerSecond
  • visitEndServerWeekOfYear
  • visitEndServerYear

Tests will need to be fixed afterwards.

@tsteur tsteur added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Needs Review PRs that need a code review labels Jan 30, 2018
@tsteur tsteur added this to the 3.3.1 milestone Jan 30, 2018
use Piwik\Columns\MetricsList;
use Piwik\Plugin\Dimension\VisitDimension;
use Piwik\Metrics\Formatter;
use function Piwik\Plugins\VisitTime\translateDayOfWeek;
Copy link
Member

Choose a reason for hiding this comment

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

use function is available in PHP 5.6+ only, but we still support 5.5.9+.
See https://secure.php.net/manual/en/language.namespaces.importing.php

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, fixed! Didn't notice it. Will have an eye on the tests once they are finished.

@tsteur
Copy link
Member Author

tsteur commented Feb 4, 2018

The only failing test now should be in CustomDimensions plugin a system test that we could fix when merged or so?

public function __construct()
{
$this->suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
return range(2016, min(2036, $maxValuesToReturn));
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if that's what it's meant to be. If $maxValuesToReturn is 30 like in the tests, it returns a range from 2016 down to 30. I guess it would be better to use something like return range(2016, 2016 + $maxValuesToReturn); ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely right, not sure what I was thinking... pushing a fix now.

Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Jus tested some of the new segments. Found one last thing. Besides that it should be good to merge.

protected $columnName = 'visit_last_action_time';
protected $type = self::TYPE_DATETIME;
protected $segmentName = 'visitEndServerDayOfWeek';
protected $nameSingular = 'VisitTime_ColumnVisitEndServerWeek';
Copy link
Member

Choose a reason for hiding this comment

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

Seems that translation key does not exists. Guess it needs to be VisitTime_ColumnVisitEndServerDayOfWeek

Copy link
Member Author

Choose a reason for hiding this comment

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

Cheers... great find. Fixed it. Will have an eye on tests.

@tsteur
Copy link
Member Author

tsteur commented Feb 11, 2018

FYI: Seems like the tests for test_AutoSuggestAPITest_visitEndServerDayOfWeek__VisitsSummary might be randomly failing. Will need to have an eye on it.

@tsteur tsteur merged commit 3b8a099 into 3.x-dev Feb 19, 2018
@tsteur tsteur deleted the datesegments branch February 19, 2018 07:55
@mattab mattab changed the title Add more date segments Add more date segments: visitEndServerDate visitEndServerDayOfMonth visitEndServerDayOfWeek visitEndServerDayOfYear, etc. Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants