@rasifix/orienteering-utils 2.0.2 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,8 +77,6 @@ var KraemerFormater = /** @class */ (function () {
77
77
  var runner = {
78
78
  id: lineObj["Melde Id"],
79
79
  category: categoryName,
80
- firstName: runnerFirstname,
81
- name: runnerName,
82
80
  fullName: [runnerFirstname, runnerName].join(" "),
83
81
  yearOfBirth: lineObj["Jg"],
84
82
  club: (strip(lineObj["Abk"]) + " " + strip(lineObj["Club"])).trim(),
@@ -26,11 +26,9 @@ function parseRunner(row, category, id) {
26
26
  }
27
27
  }
28
28
  return {
29
- id: id,
29
+ id: "" + id,
30
30
  category: category,
31
31
  rank: row[0] ? parseInt(row[0]) : undefined,
32
- firstName: row[2],
33
- name: row[1],
34
32
  fullName: [row[2], row[1]].join(" "),
35
33
  yearOfBirth: row[3],
36
34
  club: row[8],
@@ -51,13 +51,10 @@ var SolvFormat = /** @class */ (function () {
51
51
  };
52
52
  categories[categoryName] = category;
53
53
  }
54
- var name = tokens[5].split(" ");
55
54
  var runner = {
56
- id: idx,
55
+ id: "" + idx,
57
56
  category: categoryName,
58
57
  rank: tokens[4] ? parseInt(tokens[4]) : undefined,
59
- firstName: name[0],
60
- name: name.slice(1).join(" "),
61
58
  fullName: tokens[5],
62
59
  yearOfBirth: tokens[6],
63
60
  city: tokens[7],
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import * as formats from './formats';
2
- export { formats };
2
+ import * as ranking from './utils/ranking';
3
+ export { formats, ranking };
package/lib/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formats = void 0;
3
+ exports.ranking = exports.formats = void 0;
4
4
  var formats = require("./formats");
5
5
  exports.formats = formats;
6
+ var ranking = require("./utils/ranking");
7
+ exports.ranking = ranking;
@@ -1,52 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var sample = {
4
- runners: {
5
- "22": {
6
- fullName: "Hans Dobeli",
7
- club: "OLG Hopp Hopp",
8
- city: "Witzwil",
9
- category: "HB",
10
- startTime: "01:33:00",
11
- course: ["St", "31", "32", "33", "Zi"]
12
- },
13
- "23": {
14
- fullName: "Fritz Berger",
15
- club: "OLV Chapf",
16
- city: "Langnau",
17
- category: "HB",
18
- startTime: "00:55:00",
19
- course: ["St", "31", "32", "33", "Zi"]
20
- }
21
- },
22
- legs: {
23
- "St-31": {
24
- from: "St",
25
- to: "31",
26
- ranking: [
27
- {
28
- rank: 1,
29
- time: "02:33",
30
- runnerRef: "22"
31
- },
32
- {
33
- rank: 2,
34
- time: "08:02",
35
- runnerRef: "23"
36
- }
37
- ]
38
- }
39
- },
40
- ranking: [
41
- {
42
- rank: 1,
43
- runnerRef: "22",
44
- time: "38:22"
45
- },
46
- {
47
- rank: 2,
48
- runnerRef: "23",
49
- time: "46:44"
50
- }
51
- ]
52
- };
@@ -1,10 +1,8 @@
1
1
  import { Split } from "./split";
2
2
  export interface Runner {
3
- id: number;
3
+ id: string;
4
4
  category: string;
5
5
  rank?: number;
6
- name: string;
7
- firstName: string;
8
6
  fullName: string;
9
7
  yearOfBirth?: string;
10
8
  sex?: Sex;
@@ -44,16 +44,14 @@ function randInt(from, to) {
44
44
  function anonymize(competition) {
45
45
  competition.categories.forEach(function (category) {
46
46
  category.runners.forEach(function (runner) {
47
- runner.name = random(names);
48
47
  if (!runner.sex || runner.sex === 'f') {
49
- runner.firstName = random(firstNames.f);
48
+ runner.fullName = random(firstNames.f) + ' ' + random(names);
50
49
  runner.sex = runner_1.Sex.female;
51
50
  }
52
51
  else {
53
- runner.firstName = random(firstNames.m);
52
+ runner.fullName = random(firstNames.m) + ' ' + random(names);
54
53
  runner.sex = runner_1.Sex.male;
55
54
  }
56
- runner.fullName = runner.firstName + ' ' + runner.name;
57
55
  runner.city = random(cities);
58
56
  runner.club = random(clubs.prefixes) + ' ' + random(clubs.names);
59
57
  runner.yearOfBirth = '' + randInt(1925, 2010);
@@ -1,7 +1,7 @@
1
1
  import { Runner } from "../model/runner";
2
2
  export interface Course {
3
3
  code: string;
4
- runners: number[];
4
+ runners: string[];
5
5
  }
6
6
  export interface RunnerLegs {
7
7
  [key: string]: RunnerLeg;
@@ -15,7 +15,7 @@ export interface RunnerLeg {
15
15
  weight?: number;
16
16
  }
17
17
  export interface RunnerLegEntry {
18
- id: number;
18
+ id: string;
19
19
  fullName: string;
20
20
  time: number;
21
21
  split: number;
@@ -29,7 +29,7 @@ export interface RunnerLegEntry {
29
29
  position?: number;
30
30
  }
31
31
  interface RankingRunner {
32
- id: number;
32
+ id: string;
33
33
  rank?: number;
34
34
  fullName: string;
35
35
  time?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rasifix/orienteering-utils",
3
- "version": "2.0.2",
3
+ "version": "2.0.5",
4
4
  "description": "utility functions for orienteering result analyzis",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",