# unstick-claims-processor

Unstick PRT jobs with this utility.

## Setup

```
$ python3 -m venv .
$ pip install -r requirements.txt
$ cp .env.shadow .env
$ vim .env
```

## Usage

```
$ env/bin/activate
$ python unstick.py
File: <enter stuck filename>
Row: <enter stuck row_num>
```
You can also use the `--file` and `--row` flags to specify.

Use `--dry-run` flag to output update that would be run.

This does not currently restart the row, which requires connecting to Performance Rights Toolkit.

URL: http://leal-devsite.devorch.com/veal/royalty_assistant_DB/?type=claims

To restart the row, go to the URL above, find the row for file, click the "X" and then the magnifying glass to restart research.

## Example

![Example Stuck Row](stuck_claims_processor_example.png)

Running a dry run looks like this:
```
$ env/bin/activate
$ python unstick.py --dry-run
File: SX Disputes - October 2020 Processor.csv
Row: 24817
```
This would output:
```
Unsticking SX Disputes - October 2020 Processor.csv row 24817
Would execute: 
'UPDATE `USA_1_claims_262_audio_6C8D5` SET `STATUS`='X', `MATCHED ON`='NONE', `MATCH CODE`='XXX', NOTES='MANUAL SKIP - ERROR' WHERE ROW_NUM=24817'
```

If that looks good, then you would run the script for real:

```
$ env/bin/activate
$ python unstick.py
File: SX Disputes - October 2020 Processor.csv
Row: 24817
```

And it will output this:

```
Unsticking SX Disputes - October 2020 Processor.csv row 24817
Updated row with row_num 24817 in table USA_1_claims_262_audio_6C8D5
```