def _update_wikipage_string(
    wikipage_string, challengeid, teamid, challenge_name, synid
):
    """Updates wikipage strings in the challenge wiki template
    with the newly created challengeid, teamid, challenge name and project id

    Args:
        wikipage_string: Original wikipage string
        challengeid: New challenge id
        teamid: Synapse Team id
        challenge_name: challenge name
        synid: Synapse id of project

    Returns:
        fixed wiki page string
    """
    wikipage_string = wikipage_string.replace(
        "challengeId=0", "challengeId=%s" % challengeid
    )
    wikipage_string = wikipage_string.replace("{teamId}", teamid)
    wikipage_string = wikipage_string.replace("teamId=0", "teamId=%s" % teamid)
    wikipage_string = wikipage_string.replace("#!Map:0", "#!Map:%s" % teamid)
    wikipage_string = wikipage_string.replace("{challengeName}", challenge_name)
    wikipage_string = wikipage_string.replace("projectId=syn0", "projectId=%s" % synid)
    return wikipage_string