def requeue(inquiry_id: str) -> str: """Requeue the provided inquiry.""" delayed = Inquiry.query.get(inquiry_id) delayed.unlock() emitQueuePositions(delayed) emitQueueInfo(delayed.queue) return redirect(url_for('admin.resolved'))
def help_inquiry(id: str, location: str=None) -> str: """automatically selects next inquiry or reloads inquiry.""" inquiry = Inquiry.query.get(id).maybe_lock() if request.method == 'POST': delayed_id = None inquiry.resolution.close() emitQueuePositions(inquiry) emitQueueInfo(inquiry.queue) if request.form['status'] == 'resolved': inquiry.resolved() elif request.form['status'] == 'unresolved': delayed_id = id if request.form['load_next'] != 'y': if request.form['status'] == 'unresolved': inquiry.unlock() return redirect(url_for('admin.home')) return redirect( url_for( 'admin.help_latest', location=location, delayed_id=delayed_id)) return render_admin( 'help_inquiry.html', inquiry=inquiry, inquiries=Inquiry.get_current_user_inquiries(), hide_event_nav=True, group=inquiry.get_similar_inquiries(), wait_time=inquiry.get_wait_time('%h:%m:%s'))
def cancel(inquiry_id: int=None) -> str: """Cancel placed request.""" inquiry = get_inquiry_for_asker(inquiry_id) if inquiry.is_owned_by_current_user(): inquiry.close() else: abort(401, 'You cannot cancel another user\'s request. This incident' ' has been logged.') emitQueuePositions(inquiry) emitQueueInfo(inquiry.queue) return redirect(url_for('queue.home'))
def cancel(inquiry_id=None): """Cancel placed request""" inquiry = Inquiry.query.get(inquiry_id) if inquiry_id else Inquiry.query.filter_by( owner_id=current_user().id, status='unresolved', queue_id=g.queue.id).first() anon = not current_user().is_authenticated and not inquiry.owner_id non_anon = current_user().is_authenticated and inquiry.owner_id == current_user().id if anon or non_anon: inquiry.update(status='closed').save() else: return render_queue('error.html', code='404', message='You cannot cancel another user\'s request. This incident has been logged.', url=url_for('queue.home'), action='Back Home') emitQueuePositions(inquiry) emitQueueInfo(inquiry.queue) return redirect(url_for('queue.home'))
def help_inquiry(id, location=None): """automatically selects next inquiry or reloads inquiry """ inquiry = Inquiry.query.get(id) if not inquiry.resolution: inquiry.lock() inquiry.link(current_user()) if request.method == 'POST': delayed_id=None inquiry.resolution.close() # emit new queue positions emitQueuePositions(inquiry) emitQueueInfo(inquiry.queue) if request.form['status'] == 'unresolved': delayed_id = inquiry.id else: inquiry.close() if request.form['load_next'] != 'y': if delayed_id: delayed = Inquiry.query.get(delayed_id) delayed.unlock() return redirect(url_for('admin.home')) if not location: return redirect(url_for('admin.help_latest', delayed_id=delayed_id)) return redirect(url_for('admin.help_latest', location=location, delayed_id=delayed_id)) return render_admin('help_inquiry.html', inquiry=inquiry, inquiries=Inquiry.query.filter_by(name=inquiry.name).limit(10).all(), hide_event_nav=True, group=Inquiry.query.filter( Inquiry.status == 'unresolved', Inquiry.queue_id == g.queue.id, Inquiry.assignment == inquiry.assignment, Inquiry.problem == inquiry.problem, Inquiry.owner_id != inquiry.owner_id ).all(), wait_time=strfdelta( inquiry.resolution.created_at-inquiry.created_at, '%h:%m:%s'))
def requeue(inquiry_id): delayed = Inquiry.query.get(inquiry_id) delayed.unlock() emitQueuePositions(delayed) emitQueueInfo(delayed.queue) return redirect(url_for('admin.resolved'))