Skip to content

Commit

Permalink
Merge pull request #60 from RTAinJapan/merge/upstream-2022s
Browse files Browse the repository at this point in the history
Merge from GDQ/donation-tracker
  • Loading branch information
cma2819 authored Aug 3, 2022
2 parents fac15fa + 9cb4c56 commit 08f34a3
Show file tree
Hide file tree
Showing 176 changed files with 1,780 additions and 28,352 deletions.
23 changes: 19 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"parser": "@babel/eslint-parser",
"plugins": [
"react",
"react-hooks"
"react-hooks",
"simple-import-sort"
],
"parserOptions": {
"ecmaVersion": 6,
Expand Down Expand Up @@ -56,7 +57,7 @@
"no-unsafe-negation": 2,
"no-nested-ternary": 2,
"no-unused-vars": [
2,
"error",
{
"vars": "all",
"args": "none",
Expand All @@ -73,12 +74,26 @@
"react/prop-types": 1,
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": [
"warn",
"error",
{
"additionalHooks": "useCachedCallback"
}
],
"use-isnan": 2
"use-isnan": 2,
"simple-import-sort/imports": [
"error",
{
"groups": [
["^react$", "^classnames$", "^[a-z]"],
["^@(common|public|uikit)"],
["^@"],
["^\\.\\.(?!/?$)", "^\\.\\./?$", "^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
["^.+(\\.mod)?\\.css$"],
["^.+\\.(png|gif|jpe?g|webm|mov|svg)$"],
["^\\u0000"]
]
}
]
},
"overrides": [
{
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ build
node_modules/
dist/
tracker/static/gen/
geckodriver.log
yarn-error.log
TEST*.xml
test-results
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

## Requirements

- Python 3.6, 3.7 (3.8 is untested)
- Python 3.7 to 3.10
- Django 2.2, 3.2

Django 3.0, 3.1, and 4.0 are not officially supported but may work with some tweaking.

Additionally, if you are planning on developing, and/or building the JS bundles yourself:

- Node 12.x
- Node 14, or 16 (17+ is known to not work currently, see
[this issue in webpack](https://github.com/webpack/webpack/issues/14532))
- `yarn` (`npm i -g yarn`)
- `pre-commit` (`pip install pre-commit`)

Expand All @@ -16,8 +20,13 @@ very helpful.
## Deploying

This app shouldn't require any special treatment to deploy, though depending on which feature set you are using, extra
steps will be required. You should be able to install it with pip, either from PyPI (preferred so that you don't have
to build the JS bundles yourself), GitHub, or locally.
steps will be required. You should be able to install it with pip, either from GitHub, or locally. e.g.

`pip install git+https://github.com/GamesDoneQuick/donation-tracker.git@master`

Or after downloading or checking out locally:

`pip install ./donation-tracker`

For further reading on what else your server needs to look like:

Expand Down Expand Up @@ -131,13 +140,27 @@ Add the following parameter in `setting.py`:
DOMAIN = "server hostname"
```

To enable analytics tracking, add the following to the `MIDDLEWARE` section of `tracker_development/settings.py`:

```
'tracker.analytics.middleware.AnalyticsMiddleware',
```

NOTE: The analytics middleware is only a client, and does not track any information locally. Instead, it expects an analytics server to be running and will simply send out HTTP requests to it when enabled. More information is available in `tracker/analytics/README.md`.

Add the following chunk somewhere in `settings.py`:

```python
from tracker import ajax_lookup_channels
AJAX_LOOKUP_CHANNELS = ajax_lookup_channels.AJAX_LOOKUP_CHANNELS
ASGI_APPLICATION = 'tracker_development.routing.application'
CHANNEL_LAYERS = {'default': {'BACKEND': 'channels.layers.InMemoryChannelLayer'}}

# Only required if analytics tracking is enabled
TRACKER_ANALYTICS_INGEST_HOST = 'http://localhost:5000'
TRACKER_ANALYTICS_NO_EMIT = False
TRACKER_ANALYTICS_TEST_MODE = False
TRACKER_ANALYTICS_ACCESS_KEY = 'someanalyticsaccesskey or None'
```

Create a file next called `routing.py` next to `settings.py` and put the following in it:
Expand Down Expand Up @@ -171,8 +194,8 @@ import tracker.urls
import ajax_select.urls

urlpatterns = [
path('admin/', admin.site.urls),
path('admin/lookups/', include(ajax_select.urls)),
path('admin/', admin.site.urls),
path('tracker/', include(tracker.urls, namespace='tracker')),
]
```
Expand Down
40 changes: 33 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,24 @@ jobs:
displayName: Tracker Backend
strategy:
matrix:
Python36:
PYTHON_VERSION: '3.6'
Latest:
PYTHON_VERSION: '3.10'
DJANGO_VERSION: '3.2'
Oldest:
PYTHON_VERSION: '3.7'
DJANGO_VERSION: '2.2'
Django22:
PYTHON_VERSION: '3.9'
DJANGO_VERSION: '2.2'
Python37:
PYTHON_VERSION: '3.7'
DJANGO_VERSION: '3.2'
Python38:
PYTHON_VERSION: '3.8'
DJANGO_VERSION: '3.2'
Python39:
PYTHON_VERSION: '3.9'
DJANGO_VERSION: '3.2'

steps:
- task: UsePythonVersion@0
Expand All @@ -23,7 +37,7 @@ jobs:

- task: CacheBeta@1
inputs:
key: pip | $(Agent.OS) | tests/requirements.txt | setup.py
key: pip | $(Agent.OS) | "$(DJANGO_VERSION)" | tests/requirements.txt | setup.py
path: $(Pipeline.Workspace)/../../.cache/pip
displayName: 'Cache pip'

Expand All @@ -35,9 +49,11 @@ jobs:

- script: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .
pip install -r tests/requirements.txt
displayName: 'Install python prerequisites'
displayName: 'Install Python base packages'
- script: |
pip install . -r tests/requirements.txt django~=$(DJANGO_VERSION)
displayName: 'Install Python prerequisites'
- script: |
python check_migrations.py
Expand Down Expand Up @@ -79,11 +95,21 @@ jobs:
continueOnError: true
variables:
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
strategy:
matrix:
Node14:
NODE_VERSION: 14
Node16:
NODE_VERSION: 16

steps:
- task: NodeTool@0
inputs:
versionSpec: '$(NODE_VERSION)'

- task: Cache@2
inputs:
key: yarn | $(Agent.OS) | development | yarn.lock
key: yarn | $(Agent.OS) | "$(NODE_VERSION)" | development | yarn.lock
path: $(YARN_CACHE_FOLDER)
displayName: 'Cache yarn'

Expand Down
20 changes: 11 additions & 9 deletions bundles/admin/app.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import React from 'react';
import Loadable from 'react-loadable';
import { useDispatch, useSelector } from 'react-redux';
import { Route, Switch, useRouteMatch } from 'react-router';
import { Link } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
import Loadable from 'react-loadable';

import Spinner from '../public/spinner';
import Dropdown from '../public/dropdown';
import { actions } from '../public/api';
import { useConstants } from '@common/Constants';
import Loading from '@common/Loading';
import { actions } from '@public/api';
import { usePermission } from '@public/api/helpers/auth';
import Dropdown from '@public/dropdown';
import Spinner from '@public/spinner';

import { setAPIRoot } from '@tracker/Endpoints';

import ScheduleEditor from './scheduleEditor';
import Loading from '../common/Loading';
import { useConstants } from '../common/Constants';
import { setAPIRoot } from '../tracker/Endpoints';
import { usePermission } from '../public/api/helpers/auth';

const Interstitials = Loadable({
loader: () => import('./interstitials' /* webpackChunkName: 'interstitials' */),
Expand Down
1 change: 1 addition & 0 deletions bundles/admin/donationProcessing/donations.mod.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
td.comment {
max-width: 60vw;
overflow-wrap: break-word;
white-space: pre-wrap;
}

td.status {
Expand Down
Loading

0 comments on commit 08f34a3

Please sign in to comment.