Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
228
Issues
228
List
Boards
Labels
Service Desk
Milestones
Merge Requests
32
Merge Requests
32
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Compare Revisions
c2d3768c91447656e75ea1e29333db06a0add209...0e9b0089a620a66cc6f1c99c486ea836d8d95f10
Source
0e9b0089a620a66cc6f1c99c486ea836d8d95f10
Select Git revision
...
Target
c2d3768c91447656e75ea1e29333db06a0add209
Select Git revision
Compare
Commits (2)
(feat) Add my Time class for interval functions
· 7f9dd0d8
Guy Thouret
authored
18 hours ago
7f9dd0d8
(fix) Boost Campaign Stats WIP committed by mistake
· 0e9b0089
Guy Thouret
authored
3 minutes ago
0e9b0089
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
10 deletions
+54
-10
Core/Boost/Campaigns/Stats.php
Core/Boost/Campaigns/Stats.php
+0
-10
Core/Time.php
Core/Time.php
+54
-0
No files found.
Core/Boost/Campaigns/Stats.php
View file @
0e9b0089
...
...
@@ -2,18 +2,8 @@
namespace
Minds\Core\Boost\Campaigns
;
use
Elasticsearch\Client
;
class
Stats
{
/** @var Client */
protected
$esClient
;
public
function
__construct
(
Client
$esClient
)
{
}
/**
* @param Campaign $campaign
* @return array
...
...
This diff is collapsed.
Click to expand it.
Core/Time.php
0 → 100644
View file @
0e9b0089
<?php
namespace
Minds\Core
;
class
Time
{
const
HALF_HOUR
=
1800
;
const
ONE_HOUR
=
3600
;
const
TWO_HOUR
=
7200
;
const
ONE_DAY
=
86400
;
const
ONE_MIN
=
60
;
const
FIVE_MIN
=
300
;
const
TEN_MIN
=
600
;
const
FIFTEEN_MIN
=
900
;
/**
* Return the interval timestamp a timestamp is within
* @param int $ts
* @param int $interval
* @return int
*/
public
static
function
toInterval
(
int
$ts
,
int
$interval
)
{
return
$ts
-
(
$ts
%
$interval
);
}
/**
* Return an array of interval values between two timestamps
* @param int $start
* @param int $end
* @param int $interval
* @return array
*/
public
static
function
intervalsBetween
(
int
$start
,
int
$end
,
int
$interval
)
:
array
{
$startTs
=
self
::
toInterval
(
$start
,
$interval
);
$endTs
=
self
::
toInterval
(
$end
,
$interval
);
/* Exclusive not inclusive range should ignore first interval value */
if
(
$startTs
<
$endTs
)
{
$startTs
+=
$interval
;
}
$intervals
=
[];
while
(
$startTs
<=
$endTs
)
{
$intervals
[]
=
$startTs
;
$startTs
+=
$interval
;
}
return
$intervals
;
}
}
This diff is collapsed.
Click to expand it.