fix(plugins/lines): handle no history data
This commit is contained in:
1
.github/workflows/examples.yml
vendored
1
.github/workflows/examples.yml
vendored
@@ -289,7 +289,6 @@ jobs:
|
|||||||
@use.patterns
|
@use.patterns
|
||||||
*/*
|
*/*
|
||||||
+lowlighter/metrics
|
+lowlighter/metrics
|
||||||
+lowlighter/brain
|
|
||||||
output_action: none
|
output_action: none
|
||||||
delay: 120
|
delay: 120
|
||||||
user: lowlighter
|
user: lowlighter
|
||||||
|
|||||||
@@ -20,4 +20,3 @@
|
|||||||
@use.patterns
|
@use.patterns
|
||||||
*/*
|
*/*
|
||||||
+lowlighter/metrics
|
+lowlighter/metrics
|
||||||
+lowlighter/brain
|
|
||||||
|
|||||||
@@ -71,11 +71,12 @@ export default async function({login, data, imports, rest, q, account}, {enabled
|
|||||||
|
|
||||||
//Diff graphs
|
//Diff graphs
|
||||||
if (sections.includes("history")) {
|
if (sections.includes("history")) {
|
||||||
|
const weeks = result.weeks.filter(({date}) => !_history_limit ? true : new Date(date) > new Date(new Date().getFullYear() - _history_limit, 0, 0))
|
||||||
|
if (weeks.length) {
|
||||||
//Generate SVG
|
//Generate SVG
|
||||||
const height = 315, width = 480
|
const height = 315, width = 480
|
||||||
const margin = 5, offset = 34
|
const margin = 5, offset = 34
|
||||||
const {d3} = imports
|
const {d3} = imports
|
||||||
const weeks = result.weeks.filter(({date}) => !_history_limit ? true : new Date(date) > new Date(new Date().getFullYear() - _history_limit, 0, 0))
|
|
||||||
const d3n = new imports.D3node()
|
const d3n = new imports.D3node()
|
||||||
const svg = d3n.createSVG(width, height)
|
const svg = d3n.createSVG(width, height)
|
||||||
|
|
||||||
@@ -120,6 +121,11 @@ export default async function({login, data, imports, rest, q, account}, {enabled
|
|||||||
}
|
}
|
||||||
result.history = d3n.svgString()
|
result.history = d3n.svgString()
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
console.debug(`metrics/compute/${login}/plugins > lines > no history data`)
|
||||||
|
result.history = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Results
|
//Results
|
||||||
return result
|
return result
|
||||||
|
|||||||
1
tests/cases/lines.plugin.yml
generated
1
tests/cases/lines.plugin.yml
generated
@@ -18,6 +18,5 @@
|
|||||||
@use.patterns
|
@use.patterns
|
||||||
*/*
|
*/*
|
||||||
+lowlighter/metrics
|
+lowlighter/metrics
|
||||||
+lowlighter/brain
|
|
||||||
use_mocked_data: 'yes'
|
use_mocked_data: 'yes'
|
||||||
verify: 'yes'
|
verify: 'yes'
|
||||||
|
|||||||
Reference in New Issue
Block a user