Skip to content

Commit

Permalink
Expand contibuting notes
Browse files Browse the repository at this point in the history
  • Loading branch information
tontonsb committed Mar 18, 2024
1 parent a6ada3e commit fcf6d84
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 102 deletions.
83 changes: 44 additions & 39 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
## Project

All calculators must implement `Support\CalculatorInterface`.

Aim for 100% line coverage in tests. If you can't reach a line in a test, why
have the line at all?

## Testing

We use composer to set up phpunit and autoloading.

```
composer install
```

The test script is also defined in composer.

```
composer test
```

The test script includes code coverage report which relies on xdebug. If you
don't have xdebug, you can run the tests directly.

```
vendor/bin/phpunit
```

## TODO

Any improvements will be seriously considered for merging into the package.

Well thought out improvements to documentation would be greatly appreciated.

Additional editions for any of the calculators will be accepted as long as
those are actual scoring systems used somewhere.

Regarding inclusion of additional calculators — we will have to weight
relevance against the burden of maintenance.
## Project

All calculators must implement `Support\CalculatorInterface`.

Aim for 100% line coverage in tests. If you can't reach a line in a test, why
have the line at all?

## Testing

We use composer to set up phpunit and autoloading.

```
composer install
```

The test script is also defined in composer.

```
composer test
```

The test script includes code coverage report which relies on xdebug. If you
don't have xdebug, you can run the tests directly.

```
vendor/bin/phpunit
```

## Adding/editing data

The contents in `data/` is generated from `resources/` via scripts in `bin/`.
Only edit `resources/`, not data.

## TODO

Any improvements will be seriously considered for merging into the package.

Well thought out improvements to documentation would be greatly appreciated.

Additional editions for any of the calculators will be accepted as long as
those are actual scoring systems used somewhere.

Regarding inclusion of additional calculators — we will have to weight
relevance against the burden of maintenance.
135 changes: 72 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,72 @@
# IaafPoints

PHP library to calculate World Athletics (IAAF) scoring points of athletics and
WA (IAAF) scoring points for combined events. And some other evaluations of
track and field results.

> IAAF is rolling a rebrand to WA, but we currently have no plans to rename the
> package or any of classes.
The WA scoring tables that we reproduce are these ones:
https://www.worldathletics.org/about-iaaf/documents/technical-information#collapsescoring-tables

This package is used for the stats system of [Latvian Athletics Association](https://athletics.lv).

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [Changelog](#changelog)
- [License](#license)

## Installation

Use composer:

```sh
composer require glaivepro/iaafpoints
```

## Usage

This package provides mutliple calculators that all provide the same interface.

```php
// Calculator and use-case specific options.
$options = [
'gender' => 'm',
'venueType' => 'outdoor',
'discipline' => '200m',
];

// Create a calculator instance
$calculator = new \GlaivePro\IaafPoints\IaafCalculator($options);

// Evaluate a result getting some points or a class assigned to result.
$points = $calculator->evaluate(21.61);
// 980

// Update options
$calculator->setOptions(['gender' => 'f']);
$points = $calculator->evaluate(21.61);
// 1279
```

See [docs](docs) for more details.

## Changelog

It's [here](CHANGELOG.md).

## License

This package is licensed under the [MIT license](LICENSE.md).
# IaafPoints

PHP library to calculate World Athletics (IAAF) scoring points of athletics and
WA (IAAF) scoring points for combined events. And some other evaluations of
track and field results.

> IAAF is rolling a rebrand to WA, but we currently have no plans to rename the
> package or any of classes.
The WA scoring tables that we reproduce are these ones:
https://www.worldathletics.org/about-iaaf/documents/technical-information#collapsescoring-tables

This package is used for the stats system of [Latvian Athletics Association](https://athletics.lv).

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [Changelog](#changelog)
- [License](#license)

## Installation

Use composer:

```sh
composer require glaivepro/iaafpoints
```

## Usage

This package provides mutliple calculators that all provide the same interface.

```php
// Calculator and use-case specific options.
$options = [
'gender' => 'm',
'venueType' => 'outdoor',
'discipline' => '200m',
];

// Create a calculator instance
$calculator = new \GlaivePro\IaafPoints\IaafCalculator($options);

// Evaluate a result getting some points or a class assigned to result.
$points = $calculator->evaluate(21.61);
// 980

// Update options
$calculator->setOptions(['gender' => 'f']);
$points = $calculator->evaluate(21.61);
// 1279
```

See [docs](docs) for more details.

## Contributing

> [!IMPORTANT]
> Do not edit anything in `data/`, edit it in `resources/`. The files in `data/`
> are auto-generated from files in `resources/`.
More [here](CONTRIBUTING.md).

## Changelog

It's [here](CHANGELOG.md).

## License

This package is licensed under the [MIT license](LICENSE.md).

0 comments on commit fcf6d84

Please sign in to comment.