|
function productWorkWeek () { |
|
/* |
|
* On any good product day you start by drinking that sweet bean juice; oh the |
|
* joys of a socially accepted chemical addiction hehe. |
|
*/ |
|
startTheDayWithCoffee(); |
|
|
|
return function finishWorkWeekEarly () { |
|
window.cancelAnimationFrame(window.savepointLolJokeThisIsRealLife); |
|
} |
|
|
|
function startTheDayWithCoffee () { |
|
window.savepointLolJokeThisIsRealLife = window.requestAnimationFrame(anxiouslyCheckYourTaskbarsClock); |
|
} |
|
|
|
function anxiouslyCheckYourTaskbarsClock (timeOnTheClock) { |
|
/* |
|
* Ok ok ok, I just glanced the clock because I drank too much coffee and |
|
* I'd really like to go to the bathroom to pee and scroll reddit/facebook/twitter |
|
* but also need ta BURN DOWN THOSE POINTS. |
|
*/ |
|
if (window.lastTimeYouGlancedTheClock) { |
|
const smallWindowOfTimeBetweenNowAndWhenYouAnxiouslyLookedAtTheClockLast = timeOnTheClock - window.lastTimeYouGlancedTheClock; |
|
if (smallWindowOfTimeBetweenNowAndWhenYouAnxiouslyLookedAtTheClockLast > 1000 /* 1 second in humanz timesz */) { |
|
try { |
|
burndownTheKanbansBecauseCapitalism(); |
|
} catch (err) { |
|
console.error('urgh time is collapsing, my head hurts, what about my promised equity in the company???'); |
|
console.error(err); |
|
return; |
|
} |
|
} |
|
} else { |
|
window.lastTimeYouGlancedTheClock = timeOnTheClock; |
|
} |
|
|
|
startTheDayWithCoffee(); |
|
} |
|
|
|
function burndownTheKanbansBecauseCapitalism () { |
|
/* |
|
* You know when is a bad time to manage a project? No seriously tell me, I |
|
* don't have boundaries but I'd like to... |
|
* Oh also, so, we shut down the office when spending dollars at the store because shrug. |
|
*/ |
|
const outOfOfficeAndProbablyAtApplesStoreBecauseIWantToBeACoolFounderHehe = !document.querySelector('#office:not(.hidden)'); |
|
if (outOfOfficeAndProbablyAtApplesStoreBecauseIWantToBeACoolFounderHehe) return; |
|
|
|
/* |
|
* We're definitely in the office so LET'S GET THAT WHIIPP CRACKING (Yoga included) |
|
*/ |
|
const kanbanStories = Array.from(document.querySelectorAll('#kanbanboard .story:not(.busy)')); |
|
kanbanStories |
|
.sort(($a, $b) => { |
|
/* |
|
* First things first, plebians! Urgh, I mean family members, because this |
|
* company is a family... |
|
* So yeah we prioritise small tasks ok the world revolves around small tasks |
|
* because we get them done sooner and the sooner we get things done the sooner |
|
* we can tell investors that things are moving ahead hahhah̨̥a̦ha̻̟͕h̜̣̣̘̼̥͢ͅa̯ͅ |
|
*/ |
|
const storyAPoints = parseInt($a.querySelector('.points').innerText); |
|
const storyBPoints = parseInt($b.querySelector('.points').innerText); |
|
|
|
return storyAPoints > storyBPoints ? 1 : -1; |
|
}) |
|
/* REMINDER TO PM: DO NOT SHUT YOUR EYES */ |
|
.forEach(function ($kanbanStory) { |
|
/* OK FIND THE KIND OF TASK THIS STORY IS */ |
|
const taskType = Array |
|
.from($kanbanStory.classList) |
|
.find(cls =>['dev', 'test', 'ba'].includes(cls)); |
|
|
|
/* WHO IS AVAIL FOR THIS TASK?????! */ |
|
const teamFolkWhoCanDoTheTaskAtHand = Array |
|
.from( |
|
document.querySelectorAll(`#people > .person.${taskType}`) |
|
).sort(($a, $b) => { |
|
const folkASkillLevel = parseInt($a.querySelector(`.skill.${taskType}`).dataset[taskType]); |
|
const folkBSkillLevel = parseInt($b.querySelector(`.skill.${taskType}`).dataset[taskType]); |
|
|
|
/* MOST SKILLED GETS THE TASK BECAUSE WE WANNA USE THEM BEFORE THEY I̥̝̬͙͟N҉̯Ę̹̞V̴̹̻I̝̥̕T̩̭̰̣̻̭̬A͈̠͍͎̜̬B̸̭̞̹̖L̥̫͚̗͕͚Y̬̕ BURN OUT */ |
|
return folkASkillLevel > folkBSkillLevel ? 1 : -1; |
|
}).filter($person => { |
|
/* DONT LOOK AT BUSY FOLK, THEY'RE PLUGGED IN BROOOO THEY'RE PLUGGED IN */ |
|
return !Array.from($person.classList).includes('busy'); |
|
}); |
|
|
|
if (teamFolkWhoCanDoTheTaskAtHand.length > 0) { |
|
/* Yesss good job PM, you can blink now. Assign the task, CRACK WHIP, move on. */ |
|
const $person = teamFolkWhoCanDoTheTaskAtHand[0]; |
|
|
|
const personName = $person.querySelector('.name').innerText; |
|
const storyName = $kanbanStory.querySelector('.story-detail').innerText; |
|
const storyId = $kanbanStory.id; |
|
console.log(`>${storyId}< [${taskType.toUpperCase()}] ${personName} was chosen to undertake "${storyName}"`); |
|
|
|
$person.click(); |
|
$kanbanStory.click(); |
|
} |
|
}); |
|
} |
|
} |
|
|
|
/* ================================= |
|
* Begin the automation. |
|
* ================================= */ |
|
if (window.finishWorkWeekEarly) window.finishWorkWeekEarly() |
|
window.finishWorkWeekEarly = productWorkWeek(); |