Created
July 10, 2022 15:15
-
-
Save arn4v/142668f6daadfed6ba7aa9abc9d319fa to your computer and use it in GitHub Desktop.
Get time estimate from a Linear view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
maybe use
document.querySelectorAll('[data-column-id="estimate"]')
insead lol