Rev 46 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/************************************************************************** Copyright (C) 1995 Embedded Solutions* All rights reserved** file: src\dcheck.c** purpose: This module contains routines used to test the consitency* of the time data.** It will test data for one or more legs generating displays of* inconsitent data. The system will then allow the operator to* correct the data or to disqualify the team.** functions* data_check - Start the data consistency testing* correct_times - Allow the operator to modify data** programmer: David Purdie** revision date by reason* 00.0 27/01/95 DDP Tidies up the program and formatted the file***************************************************************************/#include "consts.h"#include "structs.h"#include "proto.h"/* Internal definition */int leg_end = 0; /* Legs to test */char *ck_err_mess[] = {"No error","Invalid start time","Invalid end time","End before start","Team data not entered"};/*========================================================================** Start the data consistency testing** Purpose:* This function is called to start the data consistency testing** Parameters:* None** Returns:* Nothing**========================================================================*/void data_check(void){int tm;int list = 0; /* Option to use */int i = 0; /* List counter */int count_bad = 0; /* Counter of bad teams */cur( 0, 5 );printf( "Leg times data consistency testing" );while( TRUE ){leg_end = config.num_legs;d_field( 0, 6, "Enter leg to test :", D_NUMBER, 1,( char * ) &leg_end, TRUE, M_UPDATE );if( abort_flag )return;if( leg_end > 0 && leg_end <= config.num_legs )break; /* Got what I need */beep();}printf( "\nList or Examine teams with bad times :" );switch ( getfnc( "LE" ) ){case 0:return; /* Abort exit */case 'L':list++;printf( "List" );break;default:printf( "Examine" );}/** Start the testing* Read each team into memory and start the testing*/printf( "\n\nScanning all team records\n" );for( tm = config.min_team; tm <= config.max_team; tm++ ){abort_flag = FALSE;if( valid_field( tm ) ){( void ) g_record( tm, &team_buf );if( team_buf.flags.disqualified == FALSE&& test_times( &team_buf, leg_end ) ){count_bad++;if( !list ){if( correct_times( tm, list ) ){tm--;count_bad--;}else if( abort_flag )return;}else{printf( "%4d ", tm );if( ++i > 10 ){printf( "\n" );i = 0;}flush_out();}}}}if( count_bad )printf( "\n%d teams with inconsistent data\n", count_bad );elseprintf( "\nAll team data correct\n" );beep();printf( "Any key to return to main menu : " );getinp();}/*========================================================================** Allow the operator to modify data** Purpose:* This function is called to Allow the operator to modify data** Parameters:* tm Team to process* list Mode: TRUE : Just list data* FALSE: Modify data** Returns:* This routine will return TRUE if the data was modified**========================================================================*/bool correct_times( int tm, int list ){int mods_done = FALSE;list = list; /* Keep lint quiet for now */printf( "Team %4d,Leg %d: %s ", tm, check_error.leg,ck_err_mess[check_error.type] );printf( " Ign/Disq/NoEquest/Exam :" );switch ( getfnc( "IDNE" ) ){case 0:case 'I':mods_done = FALSE;break;case 'D':team_buf.flags.disqualified = TRUE;printf( "Disqualified" );mods_done = TRUE;break;case 'N':team_buf.flags.disqualified = TRUE;team_buf.flags.non_equestrian = TRUE;printf( "No Equestrian" );mods_done = TRUE;break;case 'E':clearscreen();if( check_error.type == 4 )d_display( M_TEAM );elsed_display( M_LEGS );mods_done = TRUE;break;}put_team_record( tm, &team_buf );printf( "\n" );return ( mods_done );}/********************************* EOF ***********************************/