BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
44177cea
Commit
44177cea
authored
Mar 05, 2018
by
Dakkaron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CI charts now include the current day
parent
fc9955ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
6 deletions
+59
-6
42921-ci-charts-include-current-day.yml
...gelogs/unreleased/42921-ci-charts-include-current-day.yml
+5
-0
charts.rb
lib/gitlab/ci/charts.rb
+9
-6
charts_spec.rb
spec/lib/gitlab/ci/charts_spec.rb
+45
-0
No files found.
changelogs/unreleased/42921-ci-charts-include-current-day.yml
0 → 100644
View file @
44177cea
---
title
:
CI charts now include the current day
merge_request
:
17032
author
:
Dakkaron
type
:
changed
lib/gitlab/ci/charts.rb
View file @
44177cea
...
@@ -68,10 +68,11 @@ module Gitlab
...
@@ -68,10 +68,11 @@ module Gitlab
class
YearChart
<
Chart
class
YearChart
<
Chart
include
MonthlyInterval
include
MonthlyInterval
attr_reader
:to
,
:from
def
initialize
(
*
)
def
initialize
(
*
)
@to
=
Date
.
today
.
end_of_month
@to
=
Date
.
today
.
end_of_month
.
end_of_day
@from
=
@to
.
years_ago
(
1
).
beginning_of_month
@from
=
@to
.
years_ago
(
1
).
beginning_of_month
.
beginning_of_day
@format
=
'%d %B %Y'
@format
=
'%d %B %Y'
super
super
...
@@ -80,10 +81,11 @@ module Gitlab
...
@@ -80,10 +81,11 @@ module Gitlab
class
MonthChart
<
Chart
class
MonthChart
<
Chart
include
DailyInterval
include
DailyInterval
attr_reader
:to
,
:from
def
initialize
(
*
)
def
initialize
(
*
)
@to
=
Date
.
today
@to
=
Date
.
today
.
end_of_day
@from
=
@to
-
30
.
days
@from
=
1
.
month
.
ago
.
beginning_of_day
@format
=
'%d %B'
@format
=
'%d %B'
super
super
...
@@ -92,10 +94,11 @@ module Gitlab
...
@@ -92,10 +94,11 @@ module Gitlab
class
WeekChart
<
Chart
class
WeekChart
<
Chart
include
DailyInterval
include
DailyInterval
attr_reader
:to
,
:from
def
initialize
(
*
)
def
initialize
(
*
)
@to
=
Date
.
today
@to
=
Date
.
today
.
end_of_day
@from
=
@to
-
7
.
days
@from
=
1
.
week
.
ago
.
beginning_of_day
@format
=
'%d %B'
@format
=
'%d %B'
super
super
...
...
spec/lib/gitlab/ci/charts_spec.rb
View file @
44177cea
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Ci
::
Charts
do
describe
Gitlab
::
Ci
::
Charts
do
context
"yearchart"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:chart
)
{
Gitlab
::
Ci
::
Charts
::
YearChart
.
new
(
project
)
}
subject
{
chart
.
to
}
it
'goes until the end of the current month (including the whole last day of the month)'
do
is_expected
.
to
eq
(
Date
.
today
.
end_of_month
.
end_of_day
)
end
it
'starts at the beginning of the current year'
do
expect
(
chart
.
from
).
to
eq
(
chart
.
to
.
years_ago
(
1
).
beginning_of_month
.
beginning_of_day
)
end
end
context
"monthchart"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:chart
)
{
Gitlab
::
Ci
::
Charts
::
MonthChart
.
new
(
project
)
}
subject
{
chart
.
to
}
it
'includes the whole current day'
do
is_expected
.
to
eq
(
Date
.
today
.
end_of_day
)
end
it
'starts one month ago'
do
expect
(
chart
.
from
).
to
eq
(
1
.
month
.
ago
.
beginning_of_day
)
end
end
context
"weekchart"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:chart
)
{
Gitlab
::
Ci
::
Charts
::
WeekChart
.
new
(
project
)
}
subject
{
chart
.
to
}
it
'includes the whole current day'
do
is_expected
.
to
eq
(
Date
.
today
.
end_of_day
)
end
it
'starts one week ago'
do
expect
(
chart
.
from
).
to
eq
(
1
.
week
.
ago
.
beginning_of_day
)
end
end
context
"pipeline_times"
do
context
"pipeline_times"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:chart
)
{
Gitlab
::
Ci
::
Charts
::
PipelineTime
.
new
(
project
)
}
let
(
:chart
)
{
Gitlab
::
Ci
::
Charts
::
PipelineTime
.
new
(
project
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment