Subversion Repositories svn1-original

Rev

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

Rev 95 Rev 162
Line 27... Line 27...
27
#include    "proto.h"
27
#include    "proto.h"
28
 
28
 
29
 
29
 
30
/* Internal definition */
30
/* Internal definition */
31
 
31
 
32
int         leg_end = 0;                         /* Legs to test */
32
//int         leg_end = 0;                         /* Legs to test */
33
const char       *ck_err_mess[] = {
33
//const char       *ck_err_mess[] = {
34
    "No error",
34
//    "No error",
35
    "Invalid start time",
35
//    "Invalid start time",
36
    "Invalid end time",
36
//    "Invalid end time",
37
    "End before start",
37
//    "End before start",
38
    "Team data not entered"
38
//    "Team data not entered"
39
};
39
//};
40
 
40
 
41
/*========================================================================
41
/*========================================================================
42
 *
42
 *
43
 *  Start the data consistency testing
43
 *  Start the data consistency testing
44
 *
44
 *
Line 51... Line 51...
51
 *  Returns:
51
 *  Returns:
52
 *      Nothing
52
 *      Nothing
53
 *
53
 *
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;                       /* Option to use */
59
//    int         list;                       /* Option to use */
60
    int         i;                          /* List counter */
60
//    int         i;                          /* List counter */
61
    int         count_bad;                  /* 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 )
67
//        if ( last_loaded_leg > 0 && last_loaded_leg <= config.num_legs )
68
            leg_end = last_loaded_leg;
68
//            leg_end = last_loaded_leg;
69
        else
69
//        else
70
            leg_end = config.num_legs;
70
//            leg_end = config.num_legs;
71
 
71
 
72
        d_field( 0, 6, "Enter leg to test :", D_NUMBER, 1,
72
//        d_field( 0, 6, "Enter leg to test :", D_NUMBER, 1,
73
                 ( char * ) &leg_end, TRUE, M_UPDATE );
73
//                 ( char * ) &leg_end, TRUE, M_UPDATE );
74
        if( abort_flag )
74
//        if( abort_flag )
75
            return;
75
//            return;
76
        if( leg_end > 0 && leg_end <= config.num_legs )
76
//        if( leg_end > 0 && leg_end <= config.num_legs )
77
            break;                               /* Got what I need */
77
//            break;                               /* Got what I need */
78
        beep();
78
//        beep();
79
    }
79
//    }
80
 
80
 
81
    last_loaded_leg = leg_end;
81
//    last_loaded_leg = leg_end;
82
    for ( ; ; )
82
//    for ( ; ; )
83
    {
83
//    {
84
        printf( "\n(L)ist, (E)xamine or (Q)uit teams with bad times :" );
84
//        printf( "\n(L)ist, (E)xamine or (Q)uit teams with bad times :" );
85
        list = 0;
85
//        list = 0;
86
        count_bad = 0;
86
//        count_bad = 0;
87
        i = 0;
87
//        i = 0;
88
        switch ( getfnc( "LEQ" ) )
88
//        switch ( getfnc( "LEQ" ) )
89
        {
89
//        {
90
        case 'Q' :
90
//        case 'Q' :
91
        case 0:
91
//        case 0:
92
            return;                                  /* Abort exit */
92
//            return;                                  /* Abort exit */
93
 
93
 
94
        case 'L':
94
//        case 'L':
95
            list++;
95
//            list++;
96
            printf( "List" );
96
//            printf( "List" );
97
            break;
97
//            break;
98
 
98
 
99
        case 'E':
99
//        case 'E':
100
            printf( "Examine" );
100
//            printf( "Examine" );
101
        }
101
//        }
102
 
102
 
103
        /*
103
//        /*
104
         * Start the testing
104
//         * Start the testing
105
         * Read each team into memory and start the testing
105
//         * Read each team into memory and start the testing
106
         */
106
//         */
107
        printf( "\nScanning all team records\n" );
107
//        printf( "\nScanning all team records\n" );
108
 
108
 
109
        for( tm = config.min_team; tm <= config.max_team; tm++ )
109
//        for( tm = config.min_team; tm <= config.max_team; tm++ )
110
        {
110
//        {
111
            abort_flag = FALSE;
111
//            abort_flag = FALSE;
112
            if( valid_field( tm ) )
112
//            if( valid_field( tm ) )
113
            {
113
//            {
114
                ( void ) g_record( tm, &team_buf );
114
//                ( void ) g_record( tm, &team_buf );
115
                if( team_buf.flags.disqualified == FALSE
115
//                if( team_buf.flags.disqualified == FALSE
116
                    && test_times( &team_buf, leg_end ) )
116
//                    && test_times( &team_buf, leg_end ) )
117
                {
117
//                {
118
                    count_bad++;
118
//                    count_bad++;
119
                    if( !list )
119
//                    if( !list )
120
                    {
120
//                    {
121
                        if( correct_times( tm, list ) )
121
//                        if( correct_times( tm, list ) )
122
                        {
122
//                        {
123
                            tm--;
123
//                            tm--;
124
                            count_bad--;
124
//                            count_bad--;
125
                        }
125
//                        }
126
                        else if( abort_flag )
126
//                        else if( abort_flag )
127
                            break;;
127
//                            break;;
128
                    }
128
//                    }
129
                    else
129
//                    else
130
                    {
130
//                    {
131
                        printf( "%4d ", tm );
131
//                        printf( "%4d ", tm );
132
                        if( ++i > 10 )
132
//                        if( ++i > 10 )
133
                        {
133
//                        {
134
                            printf( "\n" );
134
//                            printf( "\n" );
135
                            i = 0;
135
//                            i = 0;
136
                        }
136
//                        }
137
                        flush_out();
137
//                        flush_out();
138
                    }
138
//                    }
139
                }
139
//                }
140
            }
140
//            }
141
        }
141
//        }
142
        if( count_bad )
142
//        if( count_bad )
143
            printf( "\n%d teams with inconsistent data", count_bad );
143
//            printf( "\n%d teams with inconsistent data", count_bad );
144
        else
144
//        else
145
            printf( "\nAll team data correct" );
145
//            printf( "\nAll team data correct" );
146
        beep();
146
//        beep();
147
    }
147
//    }
148
}
148
//}
149
 
149
 
150
/*========================================================================
150
/*========================================================================
151
 *
151
 *
152
 *  Allow the operator to modify data
152
 *  Allow the operator to modify data
153
 *
153
 *
Line 162... Line 162...
162
 *  Returns:
162
 *  Returns:
163
 *      This routine will return TRUE if the data was modified 
163
 *      This routine will return TRUE if the data was modified 
164
 *
164
 *
165
 *========================================================================*/
165
 *========================================================================*/
166
 
166
 
167
bool correct_times( int tm, int list )
167
//bool correct_times( int tm, int list )
168
{
168
//{
169
    int         mods_done = FALSE;
169
//    int         mods_done = FALSE;
170
 
170
 
171
    list = list;                                 /* Keep lint quiet for now */
171
//    list = list;                                 /* Keep lint quiet for now */
172
    printf( "Team %4d,Leg %d: %s ", tm, check_error.leg,
172
//    printf( "Team %4d,Leg %d: %s ", tm, check_error.leg,
173
            ck_err_mess[check_error.type] );
173
//            ck_err_mess[check_error.type] );
174
    printf( " Ign/Disq/NoEquest/Exam :" );
174
//    printf( " Ign/Disq/NoEquest/Exam :" );
175
    switch ( getfnc( "IDNE" ) )
175
//    switch ( getfnc( "IDNE" ) )
176
    {
176
//    {
177
    case 0:
177
//    case 0:
178
    case 'I':
178
//    case 'I':
179
        mods_done = FALSE;
179
//        mods_done = FALSE;
180
        break;
180
//        break;
181
    case 'D':
181
//    case 'D':
182
        team_buf.flags.disqualified = TRUE;
182
//        team_buf.flags.disqualified = TRUE;
183
        printf( "Disqualified" );
183
//        printf( "Disqualified" );
184
        mods_done = TRUE;
184
//        mods_done = TRUE;
185
        break;
185
//        break;
186
    case 'N':
186
//    case 'N':
187
        team_buf.flags.disqualified = TRUE;
187
//        team_buf.flags.disqualified = TRUE;
188
        team_buf.flags.non_equestrian = TRUE;
188
//        team_buf.flags.non_equestrian = TRUE;
189
        printf( "No Equestrian" );
189
//        printf( "No Equestrian" );
190
        mods_done = TRUE;
190
//        mods_done = TRUE;
191
        break;
191
//        break;
192
 
192
 
193
    case 'E':
193
//    case 'E':
194
        clearscreen();
194
//        clearscreen();
195
        if( check_error.type == 4 )
195
//        if( check_error.type == 4 )
196
            d_display( M_TEAM );
196
//            d_display( M_TEAM );
197
        else
197
//        else
198
            d_display( M_LEGS );
198
//            d_display( M_LEGS );
199
        mods_done = TRUE;
199
//        mods_done = TRUE;
200
        break;
200
//        break;
201
    }
201
//    }
202
    put_team_record( tm, &team_buf );
202
//    put_team_record( tm, &team_buf );
203
    printf( "\n" );
203
//    printf( "\n" );
204
    return ( mods_done );
204
//    return ( mods_done );
205
}
205
//}
206
 
206
 
207
/********************************* EOF ***********************************/
207
/********************************* EOF ***********************************/