Skip to content

Commit

Permalink
Merge pull request #905 from cmu-delphi/sgratzl/fix_typo
Browse files Browse the repository at this point in the history
fix: correlation table lag rendering
  • Loading branch information
sgratzl authored Apr 15, 2021
2 parents f8a2795 + c93a18a commit d2c818b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/data/correlation.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function generateLags(a, b) {
const bLag = b.slice(lag - i, b.length - i);
const bValuesLag = bValues.slice(lag - i, b.length - i);
const model = linear(zip(aWindowValues, bValuesLag));
lags.push(asLag(-i, model, aWindow, bLag));
lags.push(asLag(i === 0 ? 0 : -i, model, aWindow, bLag));
}

for (let i = 1; i <= lag; i++) {
Expand Down
5 changes: 4 additions & 1 deletion src/data/correlationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @returns string
*/
export function lagToOffset(lag, wrapped = true) {
const wrap = wrapped ? (v) => ` (${v})` : (v) => ` ${v}`;
const wrap = wrapped === 'zero' ? String : wrapped ? (v) => ` (${v})` : (v) => ` ${v}`;
if (lag === 1) {
return wrap('1 day later');
}
Expand All @@ -17,5 +17,8 @@ export function lagToOffset(lag, wrapped = true) {
if (lag < -1) {
return wrap(`${-lag} days earlier`);
}
if (wrapped === 'zero') {
return '0 days';
}
return '';
}

0 comments on commit d2c818b

Please sign in to comment.