(historyentry_pk)
Updates the episode state with the saved EpisodeHistoryEntry
Updates the episode state with the saved EpisodeHistoryEntry
Updates the episode state with the saved EpisodeHistoryEntry
def update_episode_state(historyentry_pk):
    """Updates the episode state with the saved EpisodeHistoryEntry"""

    # previously an EpisodeHistoryEntry was passed as parameters directly;
    # as there can still be tasks like this in the queue, we should still
    # be able to handle it
    if isinstance(historyentry_pk, EpisodeHistoryEntry):
        historyentry = historyentry_pk
    else:
        historyentry = EpisodeHistoryEntry.objects.get(pk=historyentry_pk)

    user = historyentry.user
    episode = historyentry.episode

    logger.info(
        "Updating Episode State for {user} / {episode}".format(
            user=user, episode=episode
        )
    )

    state = EpisodeState.objects.update_or_create(
        user=user,
        episode=episode,
        defaults={"action": historyentry.action, "timestamp": historyentry.timestamp},
    )
def update_episode_state ( historyentry_pk ) : # previously an EpisodeHistoryEntry was passed as parameters directly; # as there can still be tasks like this in the queue, we should still # be able to handle it if isinstance ( historyentry_pk , EpisodeHistoryEntry ) : historyentry = historyentry_pk else : historyentry = EpisodeHistoryEntry . objects . get ( pk = historyentry_pk ) user = historyentry . user episode = historyentry . episode logger . info ( "Updating Episode State for {user} / {episode}" . format ( user = user , episode = episode ) ) state = EpisodeState . objects . update_or_create ( user = user , episode = episode , defaults = { "action" : historyentry . action , "timestamp" : historyentry . timestamp } , )