Sort by visual tone and date

/cc @leanne1 
This if statement duplicates the if statement in lines 35-41in the sortByDate - could this be abstracted into a function?