You might be able to reuse the key function from the week view, and just add the row to that result instead of redefining the whole key function. Also same comments as above re: underscores and naming this function.