Skip to content

Commit bc83fad

Browse files
author
Павел Ахметчанов
committed
[#70] fixed by recomendation from pull-request review
1 parent cebbfee commit bc83fad

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/charts/AddSlaLine.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const getSlaLabel = (chartElement, slaPathElementIdentifier, fillColor) => {
8282
return slaLabelText;
8383
};
8484

85-
const calculateSlaProcentile = ({ slaPosition, issues, issuesCluster }) => {
85+
const calculateSlaPercentile = ({ slaPosition, issues, issuesCluster }) => {
8686
const singleIssuesUnderSlaCount = issues.filter(issue => issue.attributes.cy.value >= slaPosition).length;
8787

8888
const issuesInClustersUnderSlaCount = issuesCluster
@@ -109,41 +109,41 @@ const calculateSlaProcentile = ({ slaPosition, issues, issuesCluster }) => {
109109
return percentUnderSla;
110110
};
111111

112-
const renderSlaPercentageLabel = ({ chartElement, value, slaProcentile, slaPosition, pathId, strokeColor }) => {
112+
const renderSlaPercentageLabel = ({ chartElement, value, slaPercentile, slaPosition, pathId, strokeColor }) => {
113113
const slaLabel = getSlaLabel(chartElement, pathId, strokeColor);
114114

115115
slaLabel.firstChild.innerHTML = `${value}d`;
116-
slaLabel.lastChild.innerHTML = `${slaProcentile}%`;
116+
slaLabel.lastChild.innerHTML = `${slaPercentile}%`;
117117
slaLabel.setAttributeNS(null, 'y', slaPosition + 12);
118118
};
119119

120-
const findDiaposonForSlaRectPosition = ({ slaProcentile, ticsVals, issues, issuesCluster }) => {
120+
const findRangeForSlaRectPosition = ({ slaPercentile, ticsVals, issues, issuesCluster }) => {
121121
const maxDay = ticsVals[ticsVals.length - 1].value;
122122
const slaPosition = [0, 0];
123123
const step = maxDay < 50 ? 0.5 : 1;
124124
let pIn = 0;
125125
let day = ticsVals[0].value;
126126

127-
let fProcentile = 0;
127+
let soughtPercentile = 0;
128128
let valPosition = 0;
129129

130130
while (pIn < 2 && day <= maxDay) {
131131
valPosition = getChartLinePosition(ticsVals, day);
132-
fProcentile = calculateSlaProcentile({ slaPosition, issues, issuesCluster });
132+
soughtPercentile = calculateSlaPercentile({ slaPosition: valPosition, issues, issuesCluster });
133133

134134
day += step; // for case if user set fractional number to input
135-
if (fProcentile === slaProcentile) {
135+
if (soughtPercentile === slaPercentile) {
136136
slaPosition[pIn] = valPosition;
137137

138138
if (pIn === 0) {
139139
pIn += 1;
140-
slaPosition[pIn] = valPosition; // if one step on the one procentile
140+
slaPosition[pIn] = valPosition; // if one step on the one Percentile
141141
// eslint-disable-next-line no-continue
142142
continue;
143143
}
144144
}
145145

146-
if (pIn === 1 && fProcentile !== slaProcentile) {
146+
if (pIn === 1 && soughtPercentile !== slaPercentile) {
147147
// exit from top board
148148
pIn += 1;
149149
break;
@@ -170,9 +170,9 @@ const renderSlaLine = (sla, chartElement, changingSlaValue = sla) => {
170170
const slaPosition = getChartLinePosition(ticsVals, value);
171171
if (Number.isNaN(slaPosition)) return;
172172

173-
const slaProcentile = calculateSlaProcentile({ slaPosition, issues, issuesCluster });
174-
const [minSlaPosition, maxSlaPosition] = findDiaposonForSlaRectPosition({
175-
slaProcentile,
173+
const slaPercentile = calculateSlaPercentile({ slaPosition, issues, issuesCluster });
174+
const [minSlaPosition, maxSlaPosition] = findRangeForSlaRectPosition({
175+
slaPercentile,
176176
ticsVals,
177177
issues,
178178
issuesCluster,
@@ -187,7 +187,7 @@ const renderSlaLine = (sla, chartElement, changingSlaValue = sla) => {
187187
slaRect.setAttributeNS(null, 'width', lineLength);
188188
slaRect.setAttributeNS(null, 'height', slaRectHeight);
189189

190-
renderSlaPercentageLabel({ chartElement, value, slaProcentile, slaPosition, pathId, strokeColor });
190+
renderSlaPercentageLabel({ chartElement, value, slaPercentile, slaPosition, pathId, strokeColor });
191191
};
192192

193193
renderSvgLine({

0 commit comments

Comments
 (0)