def METHOD_NAME(request):
    try:
        if request.session.get('player'):
            player = getPlayer(request.session["player"].get("tId"))
            context = {"player": player, 'playercat': True, 'view': {'merits': True}}
            page = "player/content-reload.html" if request.POST else "player.html"
            # update merits
            if request.POST and "merits" in request.POST:
                METHOD_NAME = dict({})
                for it in json.loads(request.POST.get("merits")):
                    METHOD_NAME[it[0]] = [int(it[1]), int(it[2])]
                k, v = json.loads(request.POST.get("simu"))
                METHOD_NAME[k][0] = int(v)
                METHOD_NAME = player.getMerits(req=METHOD_NAME)
                context["merits"] = METHOD_NAME
                context["nMerits"] = request.POST.get("n_merits", 0)
                return render(request, "player/merits/index.html", context)
            else:
                req = apiCall("user", "", "personalstats,merits,honors,medals", key=player.getKey())
                for key in ["merits", "honors_awarded", "medals_awarded", "personalstats"]:
                    if key not in req:
                        context["apiErrorSub"] = req["apiError"] if "apiError" in req else "#blameched"
                        break
                if "apiErrorSub" not in context:
                    METHOD_NAME = player.getMerits(req=req["merits"])
                    context["nMerits"] = len(req.get("honors_awarded")) + len(req.get("medals_awarded")) + int(req["personalstats"].get("meritsbought", 0))
                    context["merits"] = METHOD_NAME
                return render(request, page, context)
        else:
            return returnError(type=403, msg="You might want to log in.")
    except Exception as e:
        return returnError(exc=e, session=request.session)