Skip to content

Commit 80e40a0

Browse files
committed
Renamed files to stop test suite from crashing (but still no tests...)
1 parent e05f14e commit 80e40a0

13 files changed

Lines changed: 48 additions & 9 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,5 @@ target
154154

155155
# Project
156156
staticfiles/
157-
*/migrations/*
158157
*.csv
159158
*.xlsx

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/ryecharm-overrides.xml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/ryecharm.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ make superuser
4343

4444
Then, log into the website to link your user account to the site.
4545
The command `make superuser` will then make the `swm1r18` account site staff;
46-
edit the script `make_swm1r18_superuser.py` to change the account.e
46+
edit the script `make_swm1r18_superuser.py` to change the account.
4747

4848
## Updating
4949

app/pages/academic_group/history.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from app.models import AcademicGroup
1111
from app.pages.components.suffixes import SuffixHistory
1212
from app.style import get_balance_classes
13+
from app.utility import year_to_academic_year
1314

1415

1516
class AcademicGroupHistoryList(Page):
@@ -70,12 +71,12 @@ def extra_evaluated__plot(params: Dict[str, Any], academic_group: AcademicGroup,
7071
:param staff: The Staff instance, provided via URL decoding.
7172
:return: The HTML code of the graph.
7273
"""
73-
dates: List[str] = [f"{str(timezone.now().year - 1)[-2:]}/{str(timezone.now().year)[-2:]}"]
74+
dates: List[str] = [year_to_academic_year(timezone.now())]
7475
balance_cumulative: List[float] = [academic_group.load_balance_historic + academic_group.get_load_balance()]
7576
balance_yearly: List[float] = [academic_group.get_load_balance()]
7677

7778
for academic_group_historic in academic_group.history.all():
78-
dates.append(f"{str(academic_group_historic.history_date.year - 1)[-2:]}/{str(academic_group_historic.history_date.year)[-2:]}")
79+
dates.append(year_to_academic_year(academic_group_historic.history_date.year))
7980
balance_cumulative.append(academic_group_historic.load_balance_historic + academic_group_historic.load_balance_final)
8081
balance_yearly.append(academic_group_historic.load_balance_final)
8182

app/utility.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1+
from datetime import datetime
2+
13
from django.http import HttpRequest
24

35
from app.models import AcademicGroup, Assignment, Staff, StandardLoad, Task
46

57

8+
def year_to_academic_year(date: datetime) -> str:
9+
"""
10+
Output function for producing tidy dates.
11+
12+
:param date: A datetime for the last year of an academic year (e.g. 2024/06/15)
13+
:return: The academic year that datetime belongs to (e.g. 23/24)
14+
"""
15+
return f"{str(date.year - 1)[-2:]}/{str(date.year)[-2:]}"
16+
17+
618
def update_all_loads(request: HttpRequest | None = None) -> int:
719
"""
20+
Updates the load of all assignments, staff, e.t.c.
21+
22+
A very expensive function but required given the weirdly self-referential definition.
823
24+
:param request: The web request, required to provide an output message.
925
:return: The number of cycles taken to update the full-time equivalent loads.
1026
"""
1127
standard_load: StandardLoad = StandardLoad.objects.latest()

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
source: "/etc/tls/private/"
2323
target: "/etc/tls/private/"
2424
- type: bind
25-
source: "${PROJECT_PATH}/logs/"
25+
source: "./logs/"
2626
target: "/var/www/physics-workload/logs/"
2727

2828
restart: unless-stopped
@@ -41,13 +41,13 @@ services:
4141
- "./.env"
4242
volumes:
4343
- type: bind
44-
source: "${PROJECT_PATH}/data/"
44+
source: "./data/"
4545
target: "/var/www/physics-workload/data/"
4646
- type: bind
4747
source: "./staticfiles/"
4848
target: "/var/www/physics-workload/staticfiles/"
4949
- type: bind
50-
source: "${PROJECT_PATH}/logs/"
50+
source: "./logs/"
5151
target: "/var/www/physics-workload/logs/"
5252
command:
5353
- "bash"

0 commit comments

Comments
 (0)