mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-24 16:21:53 +00:00
Message while database reset ongoing.. untested
This commit is contained in:
parent
74ce8894d2
commit
aaabcafcfe
@ -47,7 +47,14 @@ sha = hashlib.new('sha256')
|
|||||||
|
|
||||||
throw = 35.0
|
throw = 35.0
|
||||||
|
|
||||||
|
class DatabaseResetOngoing(Exception):
|
||||||
|
"""Exception class for errors while the server is reimporting everything"""
|
||||||
|
|
||||||
|
def __init__(self, message):
|
||||||
|
self.message = message
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"DatabaseResetOngoing: {self.message}"
|
||||||
|
|
||||||
# This is module-level executable. This is a Bad Thing. Especially when it touches the file system.
|
# This is module-level executable. This is a Bad Thing. Especially when it touches the file system.
|
||||||
try:
|
try:
|
||||||
|
@ -6,6 +6,7 @@ from django.conf import settings
|
|||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
|
||||||
from troggle.core.models.caves import GetCaveLookup
|
from troggle.core.models.caves import GetCaveLookup
|
||||||
from troggle.core.models.survex import SingleScan, SurvexBlock, SurvexPersonRole
|
from troggle.core.models.survex import SingleScan, SurvexBlock, SurvexPersonRole
|
||||||
from troggle.core.models.wallets import Wallet
|
from troggle.core.models.wallets import Wallet
|
||||||
@ -14,7 +15,7 @@ from troggle.core.views.expo import getmimetype
|
|||||||
from troggle.parsers.caves import add_cave_to_pending_list
|
from troggle.parsers.caves import add_cave_to_pending_list
|
||||||
from troggle.parsers.people import GetPersonExpeditionNameLookup
|
from troggle.parsers.people import GetPersonExpeditionNameLookup
|
||||||
from troggle.parsers.survex import set_walletdate
|
from troggle.parsers.survex import set_walletdate
|
||||||
from troggle.core.utils import current_expo
|
from troggle.core.utils import current_expo, DatabaseResetOngoing
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -277,7 +278,13 @@ def walletslistyear(request, year):
|
|||||||
|
|
||||||
def ticksyearwallet(year):
|
def ticksyearwallet(year):
|
||||||
manywallets = []
|
manywallets = []
|
||||||
manywallets = Wallet.objects.filter(walletyear__year=year)
|
try:
|
||||||
|
manywallets = Wallet.objects.filter(walletyear__year=year)
|
||||||
|
except OperationalError:
|
||||||
|
# Reset is ongoing on server
|
||||||
|
raise DatabaseResetOngoing(
|
||||||
|
f"Expo Database re-import ongoing on server.\nPlease wait 6 minutes.\n If still not working, contact a nerd."
|
||||||
|
)
|
||||||
|
|
||||||
fix_manywallets(manywallets)
|
fix_manywallets(manywallets)
|
||||||
return manywallets
|
return manywallets
|
||||||
|
Loading…
Reference in New Issue
Block a user