Sorts analysis results by score and then alphabetically by their identifier.

@param {Array} assessmentResults The assessment results to be sorted.

@returns {Array} The sorted results.
function sortResults( assessmentResults ) {
	return assessmentResults.sort( ( a, b ) => {
		// First compare the score.
		if ( a.score < b.score ) {
			return -1;
		}
		if ( a.score > b.score ) {
			return 1;
		}

		// If there is no difference then compare the id.
		return a.id.localeCompare( b.id );
	} );
}