mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: branches chart (resolve #322)
This commit is contained in:
parent
784adec3c1
commit
302eb33b1b
@ -21,6 +21,7 @@ LANGUAGES = {
|
||||
'PHP': 'php',
|
||||
'Blade': 'blade.php'
|
||||
}
|
||||
BRANCHES = ['master', 'feature-1', 'feature-2']
|
||||
|
||||
|
||||
class Heartbeat:
|
||||
@ -65,6 +66,7 @@ def generate_data(n: int, n_projects: int = 5, n_past_hours: int = 24) -> List[H
|
||||
p: str = random.choice(projects)
|
||||
l: str = random.choice(languages)
|
||||
f: str = randomword(random.randint(2, 8))
|
||||
b: str = random.choice(BRANCHES)
|
||||
delta: timedelta = timedelta(
|
||||
hours=random.randint(0, n_past_hours - 1),
|
||||
minutes=random.randint(0, 59),
|
||||
@ -77,6 +79,7 @@ def generate_data(n: int, n_projects: int = 5, n_past_hours: int = 24) -> List[H
|
||||
entity=f'/home/me/dev/{p}/{f}.{LANGUAGES[l]}',
|
||||
project=p,
|
||||
language=l,
|
||||
branch=b,
|
||||
time=(now - delta).timestamp()
|
||||
))
|
||||
|
||||
|
@ -331,13 +331,13 @@ function draw(subselection) {
|
||||
})
|
||||
: null
|
||||
|
||||
let branchChart = branchesCanvas && !branchesCanvas.classList.contains('hidden') && shouldUpdate(0)
|
||||
let branchChart = branchesCanvas && !branchesCanvas.classList.contains('hidden') && shouldUpdate(6)
|
||||
? new Chart(branchesCanvas.getContext('2d'), {
|
||||
type: "bar",
|
||||
data: {
|
||||
datasets: [{
|
||||
data: wakapiData.branches
|
||||
.slice(0, Math.min(showTopN[0], wakapiData.branches.length))
|
||||
.slice(0, Math.min(showTopN[6], wakapiData.branches.length))
|
||||
.map(p => parseInt(p.total)),
|
||||
backgroundColor: wakapiData.branches.map((p, i) => {
|
||||
const c = hexToRgb(getColor(p.key, i % baseColors.length))
|
||||
@ -349,7 +349,7 @@ function draw(subselection) {
|
||||
}),
|
||||
}],
|
||||
labels: wakapiData.branches
|
||||
.slice(0, Math.min(showTopN[0], wakapiData.branches.length))
|
||||
.slice(0, Math.min(showTopN[6], wakapiData.branches.length))
|
||||
.map(p => p.key)
|
||||
},
|
||||
options: {
|
||||
|
@ -1 +1 @@
|
||||
2.2.1
|
||||
2.2.2
|
Loading…
Reference in New Issue
Block a user