Subversion Repositories svn1

Rev

Rev 225 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 225 Rev 227
Line 97... Line 97...
97
#define S_LC    3                                /* Elapsed times per class */
97
#define S_LC    3                                /* Elapsed times per class */
98
#define S_LEC   4                                /* Leg end time per class */
98
#define S_LEC   4                                /* Leg end time per class */
99
#define S_FIN   5                                /* Sort on finish time at given leg */
99
#define S_FIN   5                                /* Sort on finish time at given leg */
100
#define S_TEAM  6                                /* Sort on team order */
100
#define S_TEAM  6                                /* Sort on team order */
101
#define S_CLASS 7                                /* Sort on class/team order */
101
#define S_CLASS 7                                /* Sort on class/team order */
-
 
102
#define S_LC_NE 8                                /* Elapsed times per class, with NE sorted by real class */
102
 
103
 
103
/*
104
/*
104
**  Various checking modes
105
**  Various checking modes
105
*/
106
*/
106
#define C_ELAPSED   1                            /* Check elapsed times */
107
#define C_ELAPSED   1                            /* Check elapsed times */
Line 1130... Line 1131...
1130
        if ( config.class_winners[j-1] <= 0 )
1131
        if ( config.class_winners[j-1] <= 0 )
1131
            continue;
1132
            continue;
1132
 
1133
 
1133
        winmax = config.class_winners[j-1];
1134
        winmax = config.class_winners[j-1];
1134
        {
1135
        {
1135
            int valid =   sdata.teamclass[j].total
1136
            int valid =   sdata.teamclass[j].valid;
1136
                        - sdata.teamclass[j].disqualified;
-
 
1137
//                        - sdata.teamclass[j].non_equestrian;
-
 
1138
            if ( valid < winmax )
1137
            if ( valid < winmax )
1139
                winmax = valid;
1138
                winmax = valid;
1140
        }
1139
        }
1141
 
1140
 
1142
        print( "\n");
1141
        print( "\n");
Line 1151... Line 1150...
1151
    }
1150
    }
1152
 
1151
 
1153
    /*
1152
    /*
1154
    **  Manual entries
1153
    **  Manual entries
1155
    */
1154
    */
-
 
1155
    if ( config.class_ne_winners_by_class )
-
 
1156
    {
-
 
1157
        print( "\n");
-
 
1158
        print( "    ");
-
 
1159
        if ( report_html == html ) print( "<A HREF=\"#%s_by_cat\">",url_encode(config.team_class[config.nonequestrian_class-1].full_name));
-
 
1160
        print( "%s",  tprintf( "%-*s", LEN_CLASS_NAME ,config.team_class[config.nonequestrian_class-1].full_name ));
-
 
1161
        if ( report_html == html ) print( "</A>" );
-
 
1162
        print (" by Category");
-
 
1163
    }
-
 
1164
 
-
 
1165
 
1156
    print( "\n");
1166
    print( "\n");
1157
    print( "    ");
1167
    print( "    ");
1158
    if ( report_html == html ) print( "<A HREF=\"#%s\">",url_encode("Hall Of Fame"));
1168
    if ( report_html == html ) print( "<A HREF=\"#%s\">",url_encode("Hall Of Fame"));
1159
    print( "%s",  "Hall Of Fame" );
1169
    print( "%s",  "Hall Of Fame" );
1160
    if ( report_html == html ) print( "</A>" );
1170
    if ( report_html == html ) print( "</A>" );
Line 1166... Line 1176...
1166
    if ( report_html == html ) print( "</A>" );
1176
    if ( report_html == html ) print( "</A>" );
1167
 
1177
 
1168
    /*
1178
    /*
1169
    **  Sort the data by class
1179
    **  Sort the data by class
1170
    */
1180
    */
1171
    sort_team_data( 0, S_LC );      /* Generate class placement data */
1181
    sort_team_data( 0, S_LC );     /* Generate class placement data */
1172
    last_class = -1;                /* Invalid class to start with */
1182
    last_class = -1;                /* Invalid class to start with */
1173
 
1183
 
1174
    /*
1184
    /*
1175
    **  Process each category
1185
    **  Process each category
1176
    */
1186
    */
Line 1178... Line 1188...
1178
    for( j = 1; ; j++ )
1188
    for( j = 1; ; j++ )
1179
    {
1189
    {
1180
        /*
1190
        /*
1181
        **  Tail for previous entry
1191
        **  Tail for previous entry
1182
        */
1192
        */
-
 
1193
        //if ( config.class_ne_winners_by_class && j == config.nonequestrian_class )
-
 
1194
        //    continue;
-
 
1195
 
1183
        if ( j != 1 )
1196
        if ( j != 1 )
1184
            if ( report_html == html ) print( "<A HREF=\"#%s\">Awards Index</A>",url_encode("INDEX"));
1197
            if ( report_html == html ) print( "<A HREF=\"#%s\">Awards Index</A>",url_encode("INDEX"));
1185
 
1198
 
1186
        if ( j > config.num_class  )
1199
        if ( j > config.num_class  )
1187
            break;
1200
            break;
Line 1309... Line 1322...
1309
            }
1322
            }
1310
        }
1323
        }
1311
    }
1324
    }
1312
 
1325
 
1313
    /*
1326
    /*
-
 
1327
    ** Non Equestrian winners by category
-
 
1328
    */
-
 
1329
    if ( config.class_ne_winners_by_class)
-
 
1330
    {
-
 
1331
        bool header_done = false;
-
 
1332
 
-
 
1333
        /*
-
 
1334
        **  Sort the data by class with NE data sorted by real class
-
 
1335
        */
-
 
1336
        sort_team_data( 0, S_LC_NE );      /* Generate class placement data */
-
 
1337
        last_class = -1;                   /* Invalid class to start with */
-
 
1338
 
-
 
1339
        /*
-
 
1340
        **  Only process the Non Equestrian teams in this pass
-
 
1341
        */
-
 
1342
        print( "\n");
-
 
1343
        for( j = 1; ; j++ )
-
 
1344
        {
-
 
1345
            /*
-
 
1346
            **  Tail for previous entry
-
 
1347
            */
-
 
1348
            if ( j == config.nonequestrian_class)
-
 
1349
                continue;
-
 
1350
 
-
 
1351
            if ( j != 1 )
-
 
1352
                if ( report_html == html ) print( "<A HREF=\"#%s\">Awards Index</A>",url_encode("INDEX"));
-
 
1353
 
-
 
1354
            if ( j > config.num_class  )
-
 
1355
                break;
-
 
1356
 
-
 
1357
            /*
-
 
1358
            **  Header for the (sub) class
-
 
1359
            */
-
 
1360
            if ( !header_done )
-
 
1361
            {
-
 
1362
                header_done = true;
-
 
1363
                if ( report_html == html )
-
 
1364
                {
-
 
1365
                    print( "<A name=\"%s_by_cat\"></A>",url_encode(config.team_class[config.nonequestrian_class-1].full_name));
-
 
1366
                }
-
 
1367
            }
-
 
1368
 
-
 
1369
            print( "\n");
-
 
1370
            if ( report_html == html )
-
 
1371
            {
-
 
1372
                print( "<hr>" );
-
 
1373
                print( "<A name=\"%s\"></A>",url_encode(config.team_class[j-1].full_name));
-
 
1374
            }
-
 
1375
            else
-
 
1376
            {
-
 
1377
                print( "%s\n", solid_line);
-
 
1378
            }
-
 
1379
            print( "Category: ");
-
 
1380
            if ( report_html == html ) print( "<A HREF=\"%s\">",url_encode(p_filename(filebase, config.team_class[config.nonequestrian_class - 1].abr ,"html")));
-
 
1381
            print( "%s",  config.team_class[config.nonequestrian_class-1].full_name );
-
 
1382
            if ( report_html == html ) print( "</A>" );
-
 
1383
 
-
 
1384
            print (" :: ");
-
 
1385
 
-
 
1386
            if ( report_html == html ) print( "<A HREF=\"%s\">",url_encode(p_filename(filebase, config.team_class[j - 1].abr ,"html")));
-
 
1387
            print( "%s",  config.team_class[j-1].full_name );
-
 
1388
            if ( report_html == html ) print( "</A>" );
-
 
1389
 
-
 
1390
            if ( config.class_ne_winners[j-1] <= 0 )
-
 
1391
            {
-
 
1392
                print( "\n");
-
 
1393
                print( "No winners awarded" );
-
 
1394
                if ( report_html == html ) print("<br>");
-
 
1395
                continue;
-
 
1396
            }
-
 
1397
 
-
 
1398
            /*
-
 
1399
            **  Enties for 'n' the best teams as configured
-
 
1400
            */
-
 
1401
            windex = 0;                     /* Winners done */
-
 
1402
            unsigned int i;
-
 
1403
            for( ptr = sort_data, i = 0; i < sort_num; i++, ptr++ )
-
 
1404
            {
-
 
1405
                if ( ptr->teamclass != config.nonequestrian_class ||  ptr->real_teamclass != j )
-
 
1406
                {
-
 
1407
                    continue;
-
 
1408
                }
-
 
1409
 
-
 
1410
                /*
-
 
1411
                **  Now read in the team record
-
 
1412
                */
-
 
1413
                if( valid_field( ptr->team ) && g_record( ptr->team, &team_buf ) )
-
 
1414
                {
-
 
1415
                    /*
-
 
1416
                    **  Ensure we have a valid team
-
 
1417
                    **  Can't award disqualified teams
-
 
1418
                    **  Can't award NE teams unless its a NE award
-
 
1419
                    */
-
 
1420
                    if ( ptr->flags.bad_times )
-
 
1421
                        break;
-
 
1422
 
-
 
1423
                    if ( ptr->teamclass != config.nonequestrian_class  && ptr->flags.non_equestrian )
-
 
1424
                        break;
-
 
1425
 
-
 
1426
                    /*
-
 
1427
                    **  Count the entry
-
 
1428
                    */
-
 
1429
                    windex++;
-
 
1430
 
-
 
1431
                    /*
-
 
1432
                    **  If printing an HTML report then we need to mark
-
 
1433
                    **  the entry with a reference so that we can link to it
-
 
1434
                    */
-
 
1435
                    print( "\n");
-
 
1436
                    if ( report_html == html )
-
 
1437
                    {
-
 
1438
                        print( "<A NAME=\"Team_%04d\">",team_buf.numb );
-
 
1439
                        print( "</A>" );
-
 
1440
                    }
-
 
1441
 
-
 
1442
                    /*
-
 
1443
                    **  Basic information
-
 
1444
                    **      - Team number - with Xref back to full result
-
 
1445
                    **      - Full team name
-
 
1446
                    **      - Full categoray name
-
 
1447
                    */
-
 
1448
                    print( "%s", placing(windex) );
-
 
1449
 
-
 
1450
                    print( "  Team Name: ");
-
 
1451
                    if ( report_html == html ) print( "<A HREF=\"%s#Team_%04d\">", url_encode(p_filename(filebase, "name" ,"html")), team_buf.numb );
-
 
1452
                    print( "%-*s ",     MAX_TM_NAME, team_buf.name );
-
 
1453
                        if ( report_html == html ) print( "</A>" );
-
 
1454
 
-
 
1455
                    print( "  Number: ");
-
 
1456
                    if ( report_html == html ) print( "<A HREF=\"%s#Team_%04d\">", url_encode(p_filename(filebase, "finish" ,"html")), team_buf.numb );
-
 
1457
                    print( "%4d",       team_buf.numb );
-
 
1458
                    if ( report_html == html ) print( "</A>" );
-
 
1459
 
-
 
1460
 
-
 
1461
                    for( k = 0; k < MAX_MEMB; k++ )
-
 
1462
                    {
-
 
1463
 
-
 
1464
                        /*
-
 
1465
                        **  Skip equestrian leg in the non-equestion display
-
 
1466
                        */
-
 
1467
                        if ( k + 1 == config.equestrian_leg && ptr->teamclass == config.nonequestrian_class)
-
 
1468
                            continue;
-
 
1469
 
-
 
1470
                        print( "\n");
-
 
1471
                        print( "    ");
-
 
1472
                        print( "%-*s", MAX_PERSON_NAME, config.leg_name[k] ? config.leg_name[k] : "Competitor"  );
-
 
1473
                        print( " %-*s", MAX_PERSON_NAME, team_buf.members[k].name );
-
 
1474
 
-
 
1475
                        print( "  %-8s", time_a( team_buf.leg[k+1].elapsed ) );
-
 
1476
                    }
-
 
1477
 
-
 
1478
                    print( "\n");
-
 
1479
                    print( "    ");
-
 
1480
                    print_bold( TRUE );
-
 
1481
                    print( "%-*s %-*s  %-8s", MAX_PERSON_NAME , "Total" ,MAX_PERSON_NAME, "",time_a( team_buf.leg[0].elapsed ) );
-
 
1482
                    print_bold( FALSE );
-
 
1483
                    print( "\n" );
-
 
1484
                }
-
 
1485
 
-
 
1486
 
-
 
1487
                /*
-
 
1488
                **  More to do
-
 
1489
                */
-
 
1490
                if ( windex >= config.class_ne_winners[j-1] )
-
 
1491
                {
-
 
1492
                    break;
-
 
1493
                }
-
 
1494
            }
-
 
1495
        }
-
 
1496
    }
-
 
1497
 
-
 
1498
    /*
1314
    **  Generate the Hall of Fame information
1499
    **  Generate the Hall of Fame information
1315
    */
1500
    */
1316
    print( "\n");
1501
    print( "\n");
1317
    if ( report_html == html )
1502
    if ( report_html == html )
1318
    {
1503
    {
Line 2413... Line 2598...
2413
 
2598
 
2414
    for( i = config.min_team; i <= config.max_team; i++ )
2599
    for( i = config.min_team; i <= config.max_team; i++ )
2415
    {
2600
    {
2416
        if( valid_field( i ) && g_record( i, &team_buf ) )
2601
        if( valid_field( i ) && g_record( i, &team_buf ) )
2417
        {
2602
        {
2418
            ptr->total.total++;
2603
            bool valid = true;
2419
            ptr->teamclass[team_buf.teamclass].total++;
-
 
2420
 
2604
 
2421
            if ( team_buf.flags.disqualified )
2605
            if ( team_buf.flags.disqualified )
2422
            {
2606
            {
2423
                ptr->teamclass[team_buf.teamclass].disqualified++;
2607
                ptr->teamclass[team_buf.teamclass].disqualified++;
2424
                ptr->total.disqualified++;
2608
                ptr->total.disqualified++;
-
 
2609
                valid = false;
2425
            }
2610
            }
2426
 
2611
 
2427
            if ( team_buf.flags.vet_check )
2612
            if ( team_buf.flags.vet_check )
2428
            {
2613
            {
2429
                ptr->teamclass[team_buf.teamclass].vet_check++;
2614
                ptr->teamclass[team_buf.teamclass].vet_check++;
2430
                ptr->total.vet_check++;
2615
                ptr->total.vet_check++;
-
 
2616
                valid = false;
2431
            }
2617
            }
2432
 
2618
 
2433
            if ( config.nonequestrian_class && team_buf.flags.non_equestrian )
2619
            if ( config.nonequestrian_class && team_buf.flags.non_equestrian )
2434
            {
2620
            {
2435
                ptr->teamclass[team_buf.teamclass].non_equestrian++;
2621
                ptr->teamclass[team_buf.teamclass].non_equestrian++;
2436
                ptr->total.non_equestrian++;
2622
                ptr->total.non_equestrian++;
-
 
2623
                valid = false;
-
 
2624
            }
-
 
2625
 
-
 
2626
            ptr->total.total++;
-
 
2627
            ptr->teamclass[team_buf.teamclass].total++;
-
 
2628
            if ( valid )
-
 
2629
            {
-
 
2630
                ptr->total.valid++;
-
 
2631
                ptr->teamclass[team_buf.teamclass].valid++;
2437
            }
2632
            }
2438
        }
2633
        }
2439
    }
2634
    }
2440
 
2635
 
2441
    /*
2636
    /*
Line 2443... Line 2638...
2443
    **  This is not a real category but a summary of the others.
2638
    **  This is not a real category but a summary of the others.
2444
    */
2639
    */
2445
    if ( config.nonequestrian_class  )
2640
    if ( config.nonequestrian_class  )
2446
    {
2641
    {
2447
        ptr->teamclass[config.nonequestrian_class].total += ptr->total.non_equestrian;
2642
        ptr->teamclass[config.nonequestrian_class].total += ptr->total.non_equestrian;
-
 
2643
        ptr->teamclass[config.nonequestrian_class].valid += ptr->teamclass[config.nonequestrian_class].total;
2448
    }
2644
    }
2449
}
2645
}
2450
 
2646
 
2451
/*========================================================================
2647
/*========================================================================
2452
 *
2648
 *
Line 2702... Line 2898...
2702
 
2898
 
2703
    /*
2899
    /*
2704
    **  Sorting within a class
2900
    **  Sorting within a class
2705
    **  First sort on the class
2901
    **  First sort on the class
2706
    */
2902
    */
2707
    if( sort_mode == S_LEC || sort_mode == S_LC )   /* Sort within a class */
2903
    if( sort_mode == S_LEC || sort_mode == S_LC || sort_mode == S_LC_NE )   /* Sort within a class */
2708
        if( a->teamclass != b->teamclass )
2904
        if( a->teamclass != b->teamclass )
2709
            return ( a->teamclass - b->teamclass );
2905
            return ( a->teamclass - b->teamclass );
2710
 
2906
 
2711
#if 1
2907
#if 1
2712
    /*
2908
    /*
Line 2716... Line 2912...
2716
    */
2912
    */
2717
    if ( a->teamclass == config.nonequestrian_class ||  b->teamclass == config.nonequestrian_class )
2913
    if ( a->teamclass == config.nonequestrian_class ||  b->teamclass == config.nonequestrian_class )
2718
    {
2914
    {
2719
        if ( a->teamclass == config.nonequestrian_class &&  b->teamclass == config.nonequestrian_class )
2915
        if ( a->teamclass == config.nonequestrian_class &&  b->teamclass == config.nonequestrian_class )
2720
        {
2916
        {
-
 
2917
            if (sort_mode == S_LC_NE )
-
 
2918
            {
-
 
2919
                if ( a->real_teamclass != b->real_teamclass )
-
 
2920
                {
-
 
2921
                    return ( a->real_teamclass - b->real_teamclass );
-
 
2922
                }
-
 
2923
            }
2721
        }
2924
        }
2722
        else
2925
        else
2723
        {
2926
        {
2724
            return ( a->teamclass == config.nonequestrian_class ? 1 : -1 );
2927
            return ( a->teamclass == config.nonequestrian_class ? 1 : -1 );
2725
        }
2928
        }
Line 2856... Line 3059...
2856
        break;
3059
        break;
2857
 
3060
 
2858
      /*
3061
      /*
2859
      **    Sort on Elapsed times
3062
      **    Sort on Elapsed times
2860
      */
3063
      */
-
 
3064
      case S_LC_NE:
2861
      case S_LC:
3065
      case S_LC:
2862
      case S_L:
3066
      case S_L:
2863
        ta = a->lege[sort_leg];
3067
        ta = a->lege[sort_leg];
2864
        tb = b->lege[sort_leg];
3068
        tb = b->lege[sort_leg];
2865
        break;
3069
        break;
Line 3010... Line 3214...
3010
                    ptr->lege[j] = team_buf.leg[j].elapsed;
3214
                    ptr->lege[j] = team_buf.leg[j].elapsed;
3011
                    ptr->leg[j] = team_buf.leg[j].end;
3215
                    ptr->leg[j] = team_buf.leg[j].end;
3012
                }
3216
                }
3013
                ptr->start = team_buf.leg[0].start;
3217
                ptr->start = team_buf.leg[0].start;
3014
                ptr->teamclass = team_buf.teamclass;
3218
                ptr->teamclass = team_buf.teamclass;
-
 
3219
                ptr->real_teamclass = team_buf.teamclass;
3015
 
3220
 
3016
                ptr->flags = team_buf.flags;
3221
                ptr->flags = team_buf.flags;
3017
                if (ptr->flags.non_equestrian)
3222
                if (ptr->flags.non_equestrian)
3018
                    ptr->flags.disqualified = true;
3223
                    ptr->flags.disqualified = true;
3019
                if (ptr->flags.vet_check)
3224
                if (ptr->flags.vet_check)
Line 3051... Line 3256...
3051
                        }
3256
                        }
3052
                    }
3257
                    }
3053
 
3258
 
3054
                    last->start = ptr->start = team_buf.leg[0].start;
3259
                    last->start = ptr->start = team_buf.leg[0].start;
3055
                    ptr->teamclass = config.nonequestrian_class;
3260
                    ptr->teamclass = config.nonequestrian_class;
-
 
3261
                    ptr->real_teamclass = team_buf.teamclass;
3056
                    ptr->flags = team_buf.flags;
3262
                    ptr->flags = team_buf.flags;
3057
                    ptr->flags.disqualified = false;
3263
                    ptr->flags.disqualified = false;
3058
 
3264
 
3059
 
3265
 
3060
                    ptr++;
3266
                    ptr++;