Exemple #1
0
def update_bug_user_comment():
    """
    Update the user_comment field of the specified bugs record.

    Expects two request.args
    0:      The id of the bug (str)
    1:      A string containing the updated user comment text.
    """
    bugid = int(request.args[0])
    new_comment = {'user_comment': request.vars['mytext']}
    result = Bug.update_bug(bugid, new_comment)
    return 'false' if result is False else result
Exemple #2
0
def mark_bug_read():
    """
    Set the 'hidden' field for provided bug report based on boolean provided.

    Expects two request.args
    0:      The id of the bug (str)
    1:      A string representing a boolean value (str)
    """
    bugid = int(request.args[0])
    myval = True if request.args[1] == 'true' else False
    new_status = {'hidden': myval}
    result = Bug.update_bug(bugid, new_status)
    return 'false' if result is False else result
Exemple #3
0
def update_bug():
    """
    Update any field(s) of the specified bugs record.

    Expects one request.args
    0:      The id of the bug (str)

    Excpects one request.vars value for each field to be updated. The key for
    each value must be identical to the desired field in db.bugs.
    """
    bugid = int(request.args[0])
    new_vals = {'bug_status': int(request.vars['bug_status']),
                'admin_comment': request.vars['admin_comment'],
                'adjusted_score': float(request.vars['adjusted_score']) if
                request.vars['adjusted_score'] not in
                ['none', 'None'] else None
                }
    if 'score' in list(request.vars.keys()) and \
            request.vars['log_id'] not in ['None', 'none', None]:
        logrow = db.attempt_log(int(request.vars['log_id']))
        if logrow and logrow.score <= new_vals['adjusted_score']:
            undo_vals = copy(new_vals)
            extra_vals = {'step': int(request.vars['step']),
                          'in_path': int(request.vars['in_path']),
                          'map_location': int(request.vars['map_location']),
                          'id': int(bugid),
                          'log_id': int(request.vars['log_id']),
                          'score': float(request.vars['score']),
                          'user_name': int(request.vars['user_name']),
                          'user_comment': request.vars['user_comment'],
                          'user_response': request.vars['user_response']
                          }
            undo_vals.update(extra_vals)
            trigger_bug_undo(**undo_vals)

    result = Bug.update_bug(bugid, new_vals)

    return 'false' if result is False else result