Example #1
0
def player_remove_points(profile,
                         points,
                         transaction_date,
                         message,
                         related_object=None):
    """Removes points from the user.
    If the submission date is the same as the last_awarded_submission
    field, we rollback to a previously completed task.
    """

    if not challenge_mgr.in_competition(transaction_date):
        return

    # update the scoreboard entry
    _update_scoreboard_entry(profile, points * -1, transaction_date)

    # Log the transaction.
    transaction = PointsTransaction(
        user=profile.user,
        points=points * -1,
        transaction_date=transaction_date,
        message=message,
    )
    if related_object:
        transaction.related_object = related_object
    transaction.save()

    # Invalidate info bar cache.
    cache_mgr.invalidate_template_cache("RIB", profile.user.username)
Example #2
0
def player_add_points(profile,
                      points,
                      transaction_date,
                      message,
                      related_object=None):
    """Adds points based on the point value of the submitted object."""

    # player won't get points if outside of the competitions.
    # ignore the transaction
    if not challenge_mgr.in_competition(transaction_date):
        return

    # Create a transaction first.
    transaction = PointsTransaction(
        user=profile.user,
        points=points,
        transaction_date=transaction_date,
        message=message,
    )
    if related_object:
        transaction.related_object = related_object

    transaction.save()

    # update the scoreboard entry
    _update_scoreboard_entry(profile, points, transaction_date)

    # Invalidate info bar cache.
    cache_mgr.invalidate_template_cache("RIB", profile.user.username)
def player_remove_points(profile, points, transaction_date, message, related_object=None):
    """Removes points from the user.
    If the submission date is the same as the last_awarded_submission
    field, we rollback to a previously completed task.
    """

    if not challenge_mgr.in_competition(transaction_date):
        return

    # update the scoreboard entry
    _update_scoreboard_entry(profile, points * -1, transaction_date)

    # Log the transaction.
    transaction = PointsTransaction(
        user=profile.user,
        points=points * -1,
        transaction_date=transaction_date,
        message=message,
        )
    if related_object:
        transaction.related_object = related_object
    transaction.save()

    # Invalidate info bar cache.
    cache_mgr.invalidate_template_cache("RIB", profile.user.username)
def player_add_points(profile, points, transaction_date, message, related_object=None):
    """Adds points based on the point value of the submitted object."""

    # player won't get points if outside of the competitions.
    # ignore the transaction
    if not challenge_mgr.in_competition(transaction_date):
        return

    # Create a transaction first.
    transaction = PointsTransaction(
        user=profile.user,
        points=points,
        transaction_date=transaction_date,
        message=message,
        )
    if related_object:
        transaction.related_object = related_object

    transaction.save()

    # update the scoreboard entry
    _update_scoreboard_entry(profile, points, transaction_date)

    # Invalidate info bar cache.
    cache_mgr.invalidate_template_cache("RIB", profile.user.username)
Example #5
0
def player_add_points(profile, points, transaction_date, message, related_object=None):
    """Adds points based on the point value of the submitted object."""
    # Create a transaction first.
    transaction = PointsTransaction(
        user=profile.user,
        points=points,
        transaction_date=transaction_date,
        message=message,
        )
    if related_object:
        transaction.related_object = related_object

    transaction.save()

    # update the scoreboard entry
    _update_scoreboard_entry(profile, points, transaction_date)

    # Invalidate info bar cache.
    cache_mgr.invalidate_template_cache("RIB", profile.user.username)