Skip to content

Instantly share code, notes, and snippets.

@tiagosomda
Last active March 30, 2021 20:56
Show Gist options
  • Save tiagosomda/133773c7e4ade82aa72d5930d60a39c0 to your computer and use it in GitHub Desktop.
Save tiagosomda/133773c7e4ade82aa72d5930d60a39c0 to your computer and use it in GitHub Desktop.

Random Stand Up Order

I created a little script to break up the order in which we give updates in our standup.

getting random order by with sections

# Random Stand Up Row Call Order divided by sections
##################################################################
# instead of purely random standup order,
# I want to go through the standup in a specific sections
# (leads, dev, pms, and people that only show up sometimes)
##################################################################
# input file example below:
##| ################################################################
##| labels for each section
##| ####
##| label: Leads, Devs, PMs, Usually not present
##| ##################################################################
##| # list of people begins below (csv)
##| section-index-must-be-int, any string
##| ##################################################################
##| 0, PersonA InSection 0
##| 0, PersonB InSection 0
##| 1, PersonC InSection 1
##| 1, PersonD InSection 1
##| 1, PersonE InSection 1
##| 2, PersonF InSection 2
##| 2, PersonG InSection 2
##| 3, PersonH InSection 3
##| 3, PersonI InSection 3
##################################################################
import random

sectionLabel =[]
textlines = []

with open('standup-redmond.txt') as my_file:
    textlines = my_file.readlines()

maxSection = 0
people = []
for line in textlines:
    ## skip comments
    if line.lstrip().startswith('#'):
        continue

    ## parse order label
    if line.strip().startswith('label'):
        line = line.replace('label:', '')
        sectionLabel = line.split(',')
        continue

    ## parse people and their section order
    parts = line.split(',')
    parts[0] = int(parts[0].strip())
    people.append(parts)
    if parts[0] > maxSection:
        maxSection = parts[0]

map = []
for i in range(0, maxSection+1):
    map.append([])

for person in people:
    section = person[0]
    name = person[1]
    map[section].append(name)

count = 0
print('Stand Up Call Order')
for weightSection in map:
    index_list = list(range(len(weightSection)))
    random.shuffle(index_list)
    print('---:> ' + sectionLabel[count].strip())
    count = count + 1
    for i in index_list:
        print('- ' + weightSection[i].strip())
    print('')

copying output to file and clipboard

function gso
{
  python .\random-standup-order.py | Tee-Object -FilePath "D:\hacks\standup\current-standup.txt" | clip
}

Example Files

standup-person-list.txt

################################################################
labels for each section
####
label: Leads, Devs, PMs, Usually not present
##################################################################
# list of people begins below (csv)
section-index-must-be-int, any string
##################################################################
0, PersonA InSection 0
0, PersonB InSection 0
1, PersonC InSection 1
1, PersonD InSection 1
1, PersonE InSection 1
2, PersonF InSection 2
2, PersonG InSection 2
3, PersonH InSection 3
3, PersonI InSection 3

output example:

Stand Up Call Order
---:> Leads
- PersonB InSection 0
- PersonA InSection 0

---:> Devs
- PersonC InSection 1
- PersonE InSection 1
- PersonD InSection 1

---:> PMs
- PersonF InSection 2
- PersonG InSection 2

---:> Usually not present
- PersonI InSection 3
- PersonH InSection 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment