Subversion Repositories svn1

Rev

Rev 1 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 77
Line 54... Line 54...
54
 *========================================================================*/
54
 *========================================================================*/
55
 
55
 
56
void data_check(void)
56
void data_check(void)
57
{
57
{
58
    int         tm;
58
    int         tm;
59
    int         list = 0;                        /* Option to use */
59
    int         list;                       /* Option to use */
60
    int         i = 0;                           /* List counter */
60
    int         i;                          /* List counter */
61
    int         count_bad = 0;                   /* Counter of bad teams */
61
    int         count_bad;                  /* Counter of bad teams */
62
 
62
 
63
    cur( 0, 5 );
63
    cur( 0, 5 );
64
    printf( "Leg times data consistency testing" );
64
    printf( "Leg times data consistency testing" );
65
    while( TRUE )
65
    while( TRUE )
66
    {
66
    {
-
 
67
        if ( last_loaded_leg > 0 && last_loaded_leg <= config.num_legs )
-
 
68
            leg_end = last_loaded_leg;
-
 
69
        else
67
        leg_end = config.num_legs;
70
            leg_end = config.num_legs;
-
 
71
 
68
        d_field( 0, 6, "Enter leg to test :", D_NUMBER, 1,
72
        d_field( 0, 6, "Enter leg to test :", D_NUMBER, 1,
69
                 ( char * ) &leg_end, TRUE, M_UPDATE );
73
                 ( char * ) &leg_end, TRUE, M_UPDATE );
70
        if( abort_flag )
74
        if( abort_flag )
71
            return;
75
            return;
72
        if( leg_end > 0 && leg_end <= config.num_legs )
76
        if( leg_end > 0 && leg_end <= config.num_legs )
73
            break;                               /* Got what I need */
77
            break;                               /* Got what I need */
74
        beep();
78
        beep();
75
    }
79
    }
76
 
80
 
77
    printf( "\nList or Examine teams with bad times :" );
81
    last_loaded_leg = leg_end;
78
    switch ( getfnc( "LE" ) )
82
    for ( ; ; )
79
    {
83
    {
-
 
84
        printf( "\n(L)ist, (E)xamine or (Q)uit teams with bad times :" );
-
 
85
        list = 0;
-
 
86
        count_bad = 0;
-
 
87
        i = 0;
-
 
88
        switch ( getfnc( "LEQ" ) )
-
 
89
        {
-
 
90
        case 'Q' :
80
    case 0:
91
        case 0:
81
        return;                                  /* Abort exit */
92
            return;                                  /* Abort exit */
82
 
93
 
83
    case 'L':
94
        case 'L':
84
        list++;
95
            list++;
85
        printf( "List" );
96
            printf( "List" );
86
        break;
97
            break;
87
 
98
 
88
    default:
99
        case 'E':
89
        printf( "Examine" );
100
            printf( "Examine" );
90
    }
101
        }
91
 
102
 
92
    /*
103
        /*
93
     * Start the testing
104
         * Start the testing
94
     * Read each team into memory and start the testing
105
         * Read each team into memory and start the testing
95
     */
106
         */
96
    printf( "\n\nScanning all team records\n" );
107
        printf( "\nScanning all team records\n" );
97
 
108
 
98
    for( tm = config.min_team; tm <= config.max_team; tm++ )
109
        for( tm = config.min_team; tm <= config.max_team; tm++ )
99
    {
-
 
100
        abort_flag = FALSE;
-
 
101
        if( valid_field( tm ) )
-
 
102
        {
110
        {
103
            ( void ) g_record( tm, &team_buf );
-
 
104
            if( team_buf.flags.disqualified == FALSE
111
            abort_flag = FALSE;
105
                && test_times( &team_buf, leg_end ) )
112
            if( valid_field( tm ) )
106
            {
113
            {
107
                count_bad++;
114
                ( void ) g_record( tm, &team_buf );
108
                if( !list )
115
                if( team_buf.flags.disqualified == FALSE
-
 
116
                    && test_times( &team_buf, leg_end ) )
109
                {
117
                {
-
 
118
                    count_bad++;
110
                    if( correct_times( tm, list ) )
119
                    if( !list )
111
                    {
120
                    {
-
 
121
                        if( correct_times( tm, list ) )
-
 
122
                        {
112
                        tm--;
123
                            tm--;
113
                        count_bad--;
124
                            count_bad--;
-
 
125
                        }
-
 
126
                        else if( abort_flag )
-
 
127
                            break;;
114
                    }
128
                    }
115
                    else if( abort_flag )
-
 
116
                        return;
-
 
117
                }
-
 
118
                else
129
                    else
119
                {
-
 
120
                    printf( "%4d ", tm );
-
 
121
                    if( ++i > 10 )
-
 
122
                    {
130
                    {
-
 
131
                        printf( "%4d ", tm );
-
 
132
                        if( ++i > 10 )
-
 
133
                        {
123
                        printf( "\n" );
134
                            printf( "\n" );
124
                        i = 0;
135
                            i = 0;
-
 
136
                        }
-
 
137
                        flush_out();
125
                    }
138
                    }
126
                    flush_out();
-
 
127
                }
139
                }
128
            }
140
            }
129
        }
141
        }
-
 
142
        if( count_bad )
-
 
143
            printf( "\n%d teams with inconsistent data", count_bad );
-
 
144
        else
-
 
145
            printf( "\nAll team data correct" );
-
 
146
        beep();
130
    }
147
    }
131
    if( count_bad )
-
 
132
        printf( "\n%d teams with inconsistent data\n", count_bad );
-
 
133
    else
-
 
134
        printf( "\nAll team data correct\n" );
-
 
135
    beep();
-
 
136
    printf( "Any key to return to main menu : " );
-
 
137
    getinp();
-
 
138
}
148
}
139
 
149
 
140
/*========================================================================
150
/*========================================================================
141
 *
151
 *
142
 *  Allow the operator to modify data
152
 *  Allow the operator to modify data