iyadsultan commited on
Commit
1925dc5
·
1 Parent(s): c3eae0e

Enhance logging for document navigation in evaluation process

Browse files

Update log messages to provide clearer context for document index changes during evaluation. Introduce logging for current document index when not jumping and refine skip and submit actions to improve traceability of user navigation through documents.

Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -431,10 +431,14 @@ def evaluate():
431
  documents = load_documents()
432
  if jump_to >= 1 and jump_to <= len(documents):
433
  session['current_document_index'] = jump_to # Store as 1-based index
434
- log_error(f"Jumping to document number: {jump_to} (index: {jump_to})")
435
  else:
436
  flash(f"Invalid document number. Please enter a number between 1 and {len(documents)}.")
437
  log_error(f"Invalid jump_to value: {jump_to}")
 
 
 
 
438
 
439
 
440
 
@@ -498,7 +502,10 @@ def evaluate():
498
 
499
  # Handle "Skip" action
500
  if action == 'skip':
501
- session['current_document_index'] = session.get('current_document_index', 1) + 1
 
 
 
502
  flash("Document skipped.")
503
  return redirect(url_for('evaluate'))
504
 
@@ -545,7 +552,9 @@ def evaluate():
545
  flash("Evaluation saved successfully!")
546
 
547
  # Move to next document
548
- session['current_document_index'] = current_index + 1
 
 
549
 
550
  # Check if all documents have been processed
551
  if session['current_document_index'] > len(all_documents):
 
431
  documents = load_documents()
432
  if jump_to >= 1 and jump_to <= len(documents):
433
  session['current_document_index'] = jump_to # Store as 1-based index
434
+ log_error(f"JUMP: Setting document index to {jump_to}")
435
  else:
436
  flash(f"Invalid document number. Please enter a number between 1 and {len(documents)}.")
437
  log_error(f"Invalid jump_to value: {jump_to}")
438
+ else:
439
+ # Log current position when not jumping
440
+ current_idx = session.get('current_document_index', 1)
441
+ log_error(f"CONTINUE: Current document index is {current_idx}")
442
 
443
 
444
 
 
502
 
503
  # Handle "Skip" action
504
  if action == 'skip':
505
+ current_index = session.get('current_document_index', 1)
506
+ new_index = current_index + 1
507
+ session['current_document_index'] = new_index
508
+ log_error(f"SKIP: Moved from document {current_index} to {new_index}")
509
  flash("Document skipped.")
510
  return redirect(url_for('evaluate'))
511
 
 
552
  flash("Evaluation saved successfully!")
553
 
554
  # Move to next document
555
+ new_index = current_index + 1
556
+ session['current_document_index'] = new_index
557
+ log_error(f"SUBMIT: Moved from document {current_index} to {new_index}")
558
 
559
  # Check if all documents have been processed
560
  if session['current_document_index'] > len(all_documents):