summaryrefslogtreecommitdiff
path: root/python-allianceauth-afat.spec
blob: 695708bc250bd6770acff8920f0fa775859e0b62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
%global _empty_manifest_terminate_build 0
Name:		python-allianceauth-afat
Version:	2.11.2
Release:	1
Summary:	Another Fleet Activity Tracking tool for Alliance Auth
License:	GPL-3.0
URL:		https://github.com/ppfeufer/allianceauth-afat
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/3a/e3/1122cfa622372e509ee4dc93d1b37f8d902742b5a46b5c60ac7cdce55d11/allianceauth_afat-2.11.2.tar.gz
BuildArch:	noarch

Requires:	python3-allianceauth
Requires:	python3-allianceauth-app-utils
Requires:	python3-unidecode

%description
# Alliance Auth AFAT - Another Fleet Activity Tracker

[![Version](https://img.shields.io/pypi/v/allianceauth-afat?label=release)](https://pypi.org/project/allianceauth-afat/)
[![License](https://img.shields.io/badge/license-GPLv3-green)](https://pypi.org/project/allianceauth-afat/)
[![Python](https://img.shields.io/pypi/pyversions/allianceauth-afat)](https://pypi.org/project/allianceauth-afat/)
[![Django](https://img.shields.io/pypi/djversions/allianceauth-afat?label=django)](https://pypi.org/project/allianceauth-afat/)
![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)
[![PyPI Downloads](https://img.shields.io/pypi/dm/allianceauth-afat)](https://pypi.org/project/allianceauth-afat/)
[![Code Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](http://black.readthedocs.io/en/latest/)
[![Automated Checks](https://github.com/ppfeufer/allianceauth-afat/actions/workflows/automated-checks.yml/badge.svg)](https://github.com/ppfeufer/allianceauth-afat/actions/workflows/automated-checks.yml)
[![codecov](https://codecov.io/gh/ppfeufer/allianceauth-afat/branch/master/graph/badge.svg?token=GNE88NUAKK)](https://codecov.io/gh/ppfeufer/allianceauth-afat)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/ppfeufer/aa-forum/blob/master/CODE_OF_CONDUCT.md)
[![Discord](https://img.shields.io/discord/790364535294132234?label=discord)](https://discord.gg/zmh52wnfvM)

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/N4N8CL1BY)

An Improved FAT/PAP System for
[Alliance Auth](https://gitlab.com/allianceauth/allianceauth).


## Contents

- [Features and highlights](#features-and-highlights)
- [Screenshots](#screenshots)
- [Installation](#installation)
- [Updating](#updating)
- [Data Migration](#data-migration)
    - [From Alliance Auth native FAT](#import-from-native-fat)
    - [From ImicusFAT](#import-from-imicusfat)
        - [Uninstall ImicusFAT](#uninstall-imicusfat)
- [Settings](#settings)
- [Permissions](#permissions)
- [Changelog](#changelog)
- [Credits](#credits)
- [Contributing](#contributing)


## Features and highlights

- Automatic tracking of participation on FAT links created via ESI
- Multiple ESI fleets (with your alts)
- Manually end ESI tracking per fleet
- Fleet type classification (can be added in the admin backend)
- Ship type overview per FAT link
- Graphical statistics views
- Custom module name
- Re-open FAT link if the FAT link has expired and is within the defined grace time
  (only for clickable FAT links)
- Manually add pilots to clickable FAT links, in case they missed to click the link
  (for a period of 24 hours after the FAT links original expiry time)
- Log for the following actions (Logs are kept for a certain time, 60 days per default):
    - Create FAT link
    - Change FAT link
    - Remove FAT link
    - Re-open FAT link
    - Manually add pilot to FAT link
    - Remove pilot from FAT link

AFAT will work alongside the built-in native FAT System and ImicusFAT.
However, data does not share, but you can migrate their data to AFAT, for more
information see below.

## Screenshots

### Dashboard
![AFAT Dashboard](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/afat-dashboard.png)

### FAT link list
![AFAT FAT Link LIst](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/fatlink-list.png)

### FAT link details
![AFAT FAT Link Details](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/ship-type-overview.png)

### Add FAT link view for FCs
![AFAT Add FAT Link](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/add-fatlink.png)


## Installation

### Important
This app is a plugin for Alliance Auth. If you don't have Alliance Auth running already,
please install it first before proceeding. (see the official
[AA installation guide](https://allianceauth.readthedocs.io/en/latest/installation/allianceauth.html)
for details)

**For users migrating from one of the other FAT systems, please read the specific
instructions FIRST.**

### Step 1 - Install the app

Make sure you are in the virtual environment (venv) of your Alliance Auth installation.
Then install the latest version:

```bash
pip install allianceauth-afat
```

### Step 2 - Update your AA settings

Configure your AA settings in your `local.py` as follows:

- Add `'afat',` to `INSTALLED_APPS`
- Add the scheduled tasks

```python
# AFAT - https://github.com/ppfeufer/allianceauth-afat
CELERYBEAT_SCHEDULE["afat_update_esi_fatlinks"] = {
    "task": "afat.tasks.update_esi_fatlinks",
    "schedule": crontab(minute="*/1"),
}

CELERYBEAT_SCHEDULE["afat_logrotate"] = {
    "task": "afat.tasks.logrotate",
    "schedule": crontab(minute="0", hour="1"),
}
```

### Step 3 - Finalize the installation

Run migrations & copy static files

```bash
python manage.py collectstatic
python manage.py migrate
```

Restart your supervisor services for AA.


## Updating

To update your existing installation of AFAT, first enable your
virtual environment (venv) of your Alliance Auth installation.

```bash
pip install -U allianceauth-afat

python manage.py collectstatic
python manage.py migrate
```

Finally restart your supervisor services for AA

It is possible that some versions need some more changes. Always read the
[release notes](https://github.com/ppfeufer/allianceauth-afat/releases) to find out
more.


## Data Migration

Right after the **initial** installation and running migrations,
you can import the data from Alliance Auth's native FAT system or from ImicusFAT if
you have used one of these until now.

### Import from native FAT

To import from the native FAT module, simply run the following command:

```shell
python myauth/manage.py afat_import_from_allianceauth_fat
```

### Import from ImicusFAT

To import from the ImicusFAT module, simply run the following command:

```shell
python myauth/manage.py afat_import_from_imicusfat
```

#### Uninstall ImicusFAT

Now that you've migrated, you can uninstal `ImicusFAT`.

First, remove all Django migrations for `ImicusFAT` with:

```shell
python manage.py migrate imicusfat zero
```

This will remove all migrations for `ImicusFAT` including its DB tables.

Should this command throw an error, a bit of manual labor is needed, but nothing you
can't handle, I'm sure.

```shell
python manage.py migrate imicusfat zero --fake
```

And remove all DB tables beginning with `imicusfat_` from your DB manually afterwards.

Now that the DB is cleaned up, time to remove te app.

```shell
pip uninstall allianceauth-imicusfat
```

Now remove `imicusfat` from your `INSTALLED_APPS` in your `local.py`, restart
supervisor and ... Done!


## Settings

To customize the module, the following settings are available.

| Name                             | Description                                                     | Default Value           |
|:---------------------------------|:----------------------------------------------------------------|:------------------------|
| AFAT_APP_NAME                    | Custom application name, in case you'd like a different name  | Fleet Activity Tracking |
| AFAT_DEFAULT_FATLINK_EXPIRY_TIME | Default expiry time for clickable FAT links in Minutes | 60                      |
| AFAT_DEFAULT_FATLINK_REOPEN_GRACE_TIME | Time in minutes a FAT link can be re-opened after it has expired | 60                      |
| AFAT_DEFAULT_FATLINK_REOPEN_DURATION | Time in minutes a FAT link is re-opened | 60                      |
| AFAT_DEFAULT_LOG_DURATION | Time in days before log entries are being removed from the DB | 60                      |


## Permissions

| Name | Description | Notes |
|:-----|:------------|:-----|
| basic_access | Can access the AFAT module | Your line member probably want this permission, so they can see the module and click the FAT links they are given. They also can see their own statistics with this permission. |
| manage_afat | Can manage the AFAT module | Your Military lead probably should get this permission |
| add_fatlink | Can create FAT Links | Your regular FC or who ever should be able to add FAT links should have this permission |
| stats_corporation_own | Can see own corporation statistics |  |
| stats_corporation_other | Can see statistics of other corporations |  |
| logs_view | Can view the modules logs |  |


## Changelog

To keep track of all changes, please read the
[Changelog](https://github.com/ppfeufer/allianceauth-afat/blob/master/CHANGELOG.md).


## Contributing

You want to contribute to this project? That's cool!

Please make sure to read the [contribution guidelines](https://github.com/ppfeufer/allianceauth-afat/blob/master/CONTRIBUTING.md)
(I promise, it's not much, just some basics)


## Credits

AFAT is maintained by @ppfeufer and is based on
[ImicusFAT](https://gitlab.com/evictus.iou/allianceauth-imicusfat)
by @exiom with @Aproia and @ppfeufer which is based on
[allianceauth-bfat](https://gitlab.com/colcrunch/allianceauth-bfat) by @colcrunch

Both of these modules are no longer maintained and are deprecated. Both modules will
not run with the latest stable releases of Alliance Auth.


%package -n python3-allianceauth-afat
Summary:	Another Fleet Activity Tracking tool for Alliance Auth
Provides:	python-allianceauth-afat
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-allianceauth-afat
# Alliance Auth AFAT - Another Fleet Activity Tracker

[![Version](https://img.shields.io/pypi/v/allianceauth-afat?label=release)](https://pypi.org/project/allianceauth-afat/)
[![License](https://img.shields.io/badge/license-GPLv3-green)](https://pypi.org/project/allianceauth-afat/)
[![Python](https://img.shields.io/pypi/pyversions/allianceauth-afat)](https://pypi.org/project/allianceauth-afat/)
[![Django](https://img.shields.io/pypi/djversions/allianceauth-afat?label=django)](https://pypi.org/project/allianceauth-afat/)
![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)
[![PyPI Downloads](https://img.shields.io/pypi/dm/allianceauth-afat)](https://pypi.org/project/allianceauth-afat/)
[![Code Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](http://black.readthedocs.io/en/latest/)
[![Automated Checks](https://github.com/ppfeufer/allianceauth-afat/actions/workflows/automated-checks.yml/badge.svg)](https://github.com/ppfeufer/allianceauth-afat/actions/workflows/automated-checks.yml)
[![codecov](https://codecov.io/gh/ppfeufer/allianceauth-afat/branch/master/graph/badge.svg?token=GNE88NUAKK)](https://codecov.io/gh/ppfeufer/allianceauth-afat)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/ppfeufer/aa-forum/blob/master/CODE_OF_CONDUCT.md)
[![Discord](https://img.shields.io/discord/790364535294132234?label=discord)](https://discord.gg/zmh52wnfvM)

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/N4N8CL1BY)

An Improved FAT/PAP System for
[Alliance Auth](https://gitlab.com/allianceauth/allianceauth).


## Contents

- [Features and highlights](#features-and-highlights)
- [Screenshots](#screenshots)
- [Installation](#installation)
- [Updating](#updating)
- [Data Migration](#data-migration)
    - [From Alliance Auth native FAT](#import-from-native-fat)
    - [From ImicusFAT](#import-from-imicusfat)
        - [Uninstall ImicusFAT](#uninstall-imicusfat)
- [Settings](#settings)
- [Permissions](#permissions)
- [Changelog](#changelog)
- [Credits](#credits)
- [Contributing](#contributing)


## Features and highlights

- Automatic tracking of participation on FAT links created via ESI
- Multiple ESI fleets (with your alts)
- Manually end ESI tracking per fleet
- Fleet type classification (can be added in the admin backend)
- Ship type overview per FAT link
- Graphical statistics views
- Custom module name
- Re-open FAT link if the FAT link has expired and is within the defined grace time
  (only for clickable FAT links)
- Manually add pilots to clickable FAT links, in case they missed to click the link
  (for a period of 24 hours after the FAT links original expiry time)
- Log for the following actions (Logs are kept for a certain time, 60 days per default):
    - Create FAT link
    - Change FAT link
    - Remove FAT link
    - Re-open FAT link
    - Manually add pilot to FAT link
    - Remove pilot from FAT link

AFAT will work alongside the built-in native FAT System and ImicusFAT.
However, data does not share, but you can migrate their data to AFAT, for more
information see below.

## Screenshots

### Dashboard
![AFAT Dashboard](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/afat-dashboard.png)

### FAT link list
![AFAT FAT Link LIst](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/fatlink-list.png)

### FAT link details
![AFAT FAT Link Details](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/ship-type-overview.png)

### Add FAT link view for FCs
![AFAT Add FAT Link](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/add-fatlink.png)


## Installation

### Important
This app is a plugin for Alliance Auth. If you don't have Alliance Auth running already,
please install it first before proceeding. (see the official
[AA installation guide](https://allianceauth.readthedocs.io/en/latest/installation/allianceauth.html)
for details)

**For users migrating from one of the other FAT systems, please read the specific
instructions FIRST.**

### Step 1 - Install the app

Make sure you are in the virtual environment (venv) of your Alliance Auth installation.
Then install the latest version:

```bash
pip install allianceauth-afat
```

### Step 2 - Update your AA settings

Configure your AA settings in your `local.py` as follows:

- Add `'afat',` to `INSTALLED_APPS`
- Add the scheduled tasks

```python
# AFAT - https://github.com/ppfeufer/allianceauth-afat
CELERYBEAT_SCHEDULE["afat_update_esi_fatlinks"] = {
    "task": "afat.tasks.update_esi_fatlinks",
    "schedule": crontab(minute="*/1"),
}

CELERYBEAT_SCHEDULE["afat_logrotate"] = {
    "task": "afat.tasks.logrotate",
    "schedule": crontab(minute="0", hour="1"),
}
```

### Step 3 - Finalize the installation

Run migrations & copy static files

```bash
python manage.py collectstatic
python manage.py migrate
```

Restart your supervisor services for AA.


## Updating

To update your existing installation of AFAT, first enable your
virtual environment (venv) of your Alliance Auth installation.

```bash
pip install -U allianceauth-afat

python manage.py collectstatic
python manage.py migrate
```

Finally restart your supervisor services for AA

It is possible that some versions need some more changes. Always read the
[release notes](https://github.com/ppfeufer/allianceauth-afat/releases) to find out
more.


## Data Migration

Right after the **initial** installation and running migrations,
you can import the data from Alliance Auth's native FAT system or from ImicusFAT if
you have used one of these until now.

### Import from native FAT

To import from the native FAT module, simply run the following command:

```shell
python myauth/manage.py afat_import_from_allianceauth_fat
```

### Import from ImicusFAT

To import from the ImicusFAT module, simply run the following command:

```shell
python myauth/manage.py afat_import_from_imicusfat
```

#### Uninstall ImicusFAT

Now that you've migrated, you can uninstal `ImicusFAT`.

First, remove all Django migrations for `ImicusFAT` with:

```shell
python manage.py migrate imicusfat zero
```

This will remove all migrations for `ImicusFAT` including its DB tables.

Should this command throw an error, a bit of manual labor is needed, but nothing you
can't handle, I'm sure.

```shell
python manage.py migrate imicusfat zero --fake
```

And remove all DB tables beginning with `imicusfat_` from your DB manually afterwards.

Now that the DB is cleaned up, time to remove te app.

```shell
pip uninstall allianceauth-imicusfat
```

Now remove `imicusfat` from your `INSTALLED_APPS` in your `local.py`, restart
supervisor and ... Done!


## Settings

To customize the module, the following settings are available.

| Name                             | Description                                                     | Default Value           |
|:---------------------------------|:----------------------------------------------------------------|:------------------------|
| AFAT_APP_NAME                    | Custom application name, in case you'd like a different name  | Fleet Activity Tracking |
| AFAT_DEFAULT_FATLINK_EXPIRY_TIME | Default expiry time for clickable FAT links in Minutes | 60                      |
| AFAT_DEFAULT_FATLINK_REOPEN_GRACE_TIME | Time in minutes a FAT link can be re-opened after it has expired | 60                      |
| AFAT_DEFAULT_FATLINK_REOPEN_DURATION | Time in minutes a FAT link is re-opened | 60                      |
| AFAT_DEFAULT_LOG_DURATION | Time in days before log entries are being removed from the DB | 60                      |


## Permissions

| Name | Description | Notes |
|:-----|:------------|:-----|
| basic_access | Can access the AFAT module | Your line member probably want this permission, so they can see the module and click the FAT links they are given. They also can see their own statistics with this permission. |
| manage_afat | Can manage the AFAT module | Your Military lead probably should get this permission |
| add_fatlink | Can create FAT Links | Your regular FC or who ever should be able to add FAT links should have this permission |
| stats_corporation_own | Can see own corporation statistics |  |
| stats_corporation_other | Can see statistics of other corporations |  |
| logs_view | Can view the modules logs |  |


## Changelog

To keep track of all changes, please read the
[Changelog](https://github.com/ppfeufer/allianceauth-afat/blob/master/CHANGELOG.md).


## Contributing

You want to contribute to this project? That's cool!

Please make sure to read the [contribution guidelines](https://github.com/ppfeufer/allianceauth-afat/blob/master/CONTRIBUTING.md)
(I promise, it's not much, just some basics)


## Credits

AFAT is maintained by @ppfeufer and is based on
[ImicusFAT](https://gitlab.com/evictus.iou/allianceauth-imicusfat)
by @exiom with @Aproia and @ppfeufer which is based on
[allianceauth-bfat](https://gitlab.com/colcrunch/allianceauth-bfat) by @colcrunch

Both of these modules are no longer maintained and are deprecated. Both modules will
not run with the latest stable releases of Alliance Auth.


%package help
Summary:	Development documents and examples for allianceauth-afat
Provides:	python3-allianceauth-afat-doc
%description help
# Alliance Auth AFAT - Another Fleet Activity Tracker

[![Version](https://img.shields.io/pypi/v/allianceauth-afat?label=release)](https://pypi.org/project/allianceauth-afat/)
[![License](https://img.shields.io/badge/license-GPLv3-green)](https://pypi.org/project/allianceauth-afat/)
[![Python](https://img.shields.io/pypi/pyversions/allianceauth-afat)](https://pypi.org/project/allianceauth-afat/)
[![Django](https://img.shields.io/pypi/djversions/allianceauth-afat?label=django)](https://pypi.org/project/allianceauth-afat/)
![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)
[![PyPI Downloads](https://img.shields.io/pypi/dm/allianceauth-afat)](https://pypi.org/project/allianceauth-afat/)
[![Code Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](http://black.readthedocs.io/en/latest/)
[![Automated Checks](https://github.com/ppfeufer/allianceauth-afat/actions/workflows/automated-checks.yml/badge.svg)](https://github.com/ppfeufer/allianceauth-afat/actions/workflows/automated-checks.yml)
[![codecov](https://codecov.io/gh/ppfeufer/allianceauth-afat/branch/master/graph/badge.svg?token=GNE88NUAKK)](https://codecov.io/gh/ppfeufer/allianceauth-afat)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/ppfeufer/aa-forum/blob/master/CODE_OF_CONDUCT.md)
[![Discord](https://img.shields.io/discord/790364535294132234?label=discord)](https://discord.gg/zmh52wnfvM)

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/N4N8CL1BY)

An Improved FAT/PAP System for
[Alliance Auth](https://gitlab.com/allianceauth/allianceauth).


## Contents

- [Features and highlights](#features-and-highlights)
- [Screenshots](#screenshots)
- [Installation](#installation)
- [Updating](#updating)
- [Data Migration](#data-migration)
    - [From Alliance Auth native FAT](#import-from-native-fat)
    - [From ImicusFAT](#import-from-imicusfat)
        - [Uninstall ImicusFAT](#uninstall-imicusfat)
- [Settings](#settings)
- [Permissions](#permissions)
- [Changelog](#changelog)
- [Credits](#credits)
- [Contributing](#contributing)


## Features and highlights

- Automatic tracking of participation on FAT links created via ESI
- Multiple ESI fleets (with your alts)
- Manually end ESI tracking per fleet
- Fleet type classification (can be added in the admin backend)
- Ship type overview per FAT link
- Graphical statistics views
- Custom module name
- Re-open FAT link if the FAT link has expired and is within the defined grace time
  (only for clickable FAT links)
- Manually add pilots to clickable FAT links, in case they missed to click the link
  (for a period of 24 hours after the FAT links original expiry time)
- Log for the following actions (Logs are kept for a certain time, 60 days per default):
    - Create FAT link
    - Change FAT link
    - Remove FAT link
    - Re-open FAT link
    - Manually add pilot to FAT link
    - Remove pilot from FAT link

AFAT will work alongside the built-in native FAT System and ImicusFAT.
However, data does not share, but you can migrate their data to AFAT, for more
information see below.

## Screenshots

### Dashboard
![AFAT Dashboard](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/afat-dashboard.png)

### FAT link list
![AFAT FAT Link LIst](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/fatlink-list.png)

### FAT link details
![AFAT FAT Link Details](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/ship-type-overview.png)

### Add FAT link view for FCs
![AFAT Add FAT Link](https://raw.githubusercontent.com/ppfeufer/allianceauth-afat/master/afat/docs/images/add-fatlink.png)


## Installation

### Important
This app is a plugin for Alliance Auth. If you don't have Alliance Auth running already,
please install it first before proceeding. (see the official
[AA installation guide](https://allianceauth.readthedocs.io/en/latest/installation/allianceauth.html)
for details)

**For users migrating from one of the other FAT systems, please read the specific
instructions FIRST.**

### Step 1 - Install the app

Make sure you are in the virtual environment (venv) of your Alliance Auth installation.
Then install the latest version:

```bash
pip install allianceauth-afat
```

### Step 2 - Update your AA settings

Configure your AA settings in your `local.py` as follows:

- Add `'afat',` to `INSTALLED_APPS`
- Add the scheduled tasks

```python
# AFAT - https://github.com/ppfeufer/allianceauth-afat
CELERYBEAT_SCHEDULE["afat_update_esi_fatlinks"] = {
    "task": "afat.tasks.update_esi_fatlinks",
    "schedule": crontab(minute="*/1"),
}

CELERYBEAT_SCHEDULE["afat_logrotate"] = {
    "task": "afat.tasks.logrotate",
    "schedule": crontab(minute="0", hour="1"),
}
```

### Step 3 - Finalize the installation

Run migrations & copy static files

```bash
python manage.py collectstatic
python manage.py migrate
```

Restart your supervisor services for AA.


## Updating

To update your existing installation of AFAT, first enable your
virtual environment (venv) of your Alliance Auth installation.

```bash
pip install -U allianceauth-afat

python manage.py collectstatic
python manage.py migrate
```

Finally restart your supervisor services for AA

It is possible that some versions need some more changes. Always read the
[release notes](https://github.com/ppfeufer/allianceauth-afat/releases) to find out
more.


## Data Migration

Right after the **initial** installation and running migrations,
you can import the data from Alliance Auth's native FAT system or from ImicusFAT if
you have used one of these until now.

### Import from native FAT

To import from the native FAT module, simply run the following command:

```shell
python myauth/manage.py afat_import_from_allianceauth_fat
```

### Import from ImicusFAT

To import from the ImicusFAT module, simply run the following command:

```shell
python myauth/manage.py afat_import_from_imicusfat
```

#### Uninstall ImicusFAT

Now that you've migrated, you can uninstal `ImicusFAT`.

First, remove all Django migrations for `ImicusFAT` with:

```shell
python manage.py migrate imicusfat zero
```

This will remove all migrations for `ImicusFAT` including its DB tables.

Should this command throw an error, a bit of manual labor is needed, but nothing you
can't handle, I'm sure.

```shell
python manage.py migrate imicusfat zero --fake
```

And remove all DB tables beginning with `imicusfat_` from your DB manually afterwards.

Now that the DB is cleaned up, time to remove te app.

```shell
pip uninstall allianceauth-imicusfat
```

Now remove `imicusfat` from your `INSTALLED_APPS` in your `local.py`, restart
supervisor and ... Done!


## Settings

To customize the module, the following settings are available.

| Name                             | Description                                                     | Default Value           |
|:---------------------------------|:----------------------------------------------------------------|:------------------------|
| AFAT_APP_NAME                    | Custom application name, in case you'd like a different name  | Fleet Activity Tracking |
| AFAT_DEFAULT_FATLINK_EXPIRY_TIME | Default expiry time for clickable FAT links in Minutes | 60                      |
| AFAT_DEFAULT_FATLINK_REOPEN_GRACE_TIME | Time in minutes a FAT link can be re-opened after it has expired | 60                      |
| AFAT_DEFAULT_FATLINK_REOPEN_DURATION | Time in minutes a FAT link is re-opened | 60                      |
| AFAT_DEFAULT_LOG_DURATION | Time in days before log entries are being removed from the DB | 60                      |


## Permissions

| Name | Description | Notes |
|:-----|:------------|:-----|
| basic_access | Can access the AFAT module | Your line member probably want this permission, so they can see the module and click the FAT links they are given. They also can see their own statistics with this permission. |
| manage_afat | Can manage the AFAT module | Your Military lead probably should get this permission |
| add_fatlink | Can create FAT Links | Your regular FC or who ever should be able to add FAT links should have this permission |
| stats_corporation_own | Can see own corporation statistics |  |
| stats_corporation_other | Can see statistics of other corporations |  |
| logs_view | Can view the modules logs |  |


## Changelog

To keep track of all changes, please read the
[Changelog](https://github.com/ppfeufer/allianceauth-afat/blob/master/CHANGELOG.md).


## Contributing

You want to contribute to this project? That's cool!

Please make sure to read the [contribution guidelines](https://github.com/ppfeufer/allianceauth-afat/blob/master/CONTRIBUTING.md)
(I promise, it's not much, just some basics)


## Credits

AFAT is maintained by @ppfeufer and is based on
[ImicusFAT](https://gitlab.com/evictus.iou/allianceauth-imicusfat)
by @exiom with @Aproia and @ppfeufer which is based on
[allianceauth-bfat](https://gitlab.com/colcrunch/allianceauth-bfat) by @colcrunch

Both of these modules are no longer maintained and are deprecated. Both modules will
not run with the latest stable releases of Alliance Auth.


%prep
%autosetup -n allianceauth-afat-2.11.2

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-allianceauth-afat -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 2.11.2-1
- Package Spec generated