Merge branch 'master' into signup_helper

This commit is contained in:
2023-08-20 23:06:02 +00:00
6 changed files with 23 additions and 28 deletions

View File

@@ -157,7 +157,7 @@ def gen_search_strings():
start = time.time()
search_strings = {}
for m in models.Member.objects.order_by('-expire_date'):
for m in models.Member.objects.order_by('-expire_date').prefetch_related('user__storage'):
string = '{} {} | {} {}'.format(
m.preferred_name,
m.last_name,
@@ -166,11 +166,18 @@ def gen_search_strings():
)
string += ' | ' + m.user.email
string += ' | ' + m.discourse_username
if m.discourse_username:
string += ' | ' + m.discourse_username
string += ' | ' + str(m.id)
for s in m.user.storage.all():
string += ' | ' + s.shelf_id
string = string.lower()
search_strings[string] = m.id
cache.set('search_strings', search_strings)
logger.info('Generated search strings in %s s.', time.time() - start)

View File

@@ -99,9 +99,9 @@ class SearchViewSet(Base, Retrieve):
queryset = queryset.order_by('-vetted_date', '-id')
elif sort == 'newest_active':
queryset = queryset.filter(paused_date__isnull=True)
queryset = queryset.order_by('-application_date', '-id')
queryset = queryset.order_by('-current_start_date', '-id')
elif sort == 'newest_overall':
queryset = queryset.order_by('-application_date', '-id')
queryset = queryset.order_by('-current_start_date', '-id')
elif sort == 'oldest_active':
queryset = queryset.filter(paused_date__isnull=True)
queryset = queryset.order_by('application_date', 'id')
@@ -1605,7 +1605,7 @@ class ProtocoinViewSet(Base):
memo = 'Protocoin - Purchase spent ₱ {} printing {}'.format(
total_cost,
request.data['job_name'],
request.data['job_name'][:100],
)
tx = models.Transaction.objects.create(