Skip to content

Instantly share code, notes, and snippets.

@arn4v
Created July 10, 2022 15:15
Show Gist options
  • Save arn4v/142668f6daadfed6ba7aa9abc9d319fa to your computer and use it in GitHub Desktop.
Save arn4v/142668f6daadfed6ba7aa9abc9d319fa to your computer and use it in GitHub Desktop.
Get time estimate from a Linear view
const sizeToTimeEstimate = {
xs: 1,
s: 2,
m: 4,
l: 12,
xl: 24,
};
const timeMap = Object.entries(
Array.from(
document.querySelectorAll(
"a.sc-lfTHDD > div div[class='sc-bczRLJ bYuhVy sc-cCsOjp jCLUHI sc-gXmSlM sc-eKoGHk cicKMg kaIKBY'] > span"
)
)
.map((item) => item.innerHTML)
.reduce((acc, cur) => {
if (acc[cur]) acc[cur] = acc[cur] + 1;
else acc[cur] = 1;
return acc;
}, {})
).reduce((acc, [key, value]) => {
key = key.toLowerCase();
acc[key] = sizeToTimeEstimate[key] * value;
return acc;
}, {});
const total = Object.values(timeMap).reduce((acc, cur) => acc + cur, 0);
console.log(JSON.stringify(timeMap, null, 2), '\n', total);
@moritzWa
Copy link

maybe use document.querySelectorAll('[data-column-id="estimate"]') insead lol

@moritzWa
Copy link

bump @arn4v

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment