Example #1
0
    def get_artist_listened_tuples(self, artist_name):
        artist_listened_tuples = []

        listened_tuples = library_dao.get_listened_tuples_by_artist_name_for_users(artist_name)

        youple = None

        for user_id, timestamp in listened_tuples:
            user = security_dao.get_user(user_id)

            listened_tuple = (user, timestamp)

            if user_id == cherrypy.request.user.id:
                youple = listened_tuple
            else:
                artist_listened_tuples.append(listened_tuple)

        if youple is not None:
            artist_listened_tuples.insert(0, youple)

        return artist_listened_tuples