Merge branch 'master' into signup_helper
This commit is contained in:
commit
3dc450437b
|
@ -157,7 +157,7 @@ def gen_search_strings():
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
search_strings = {}
|
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(
|
string = '{} {} | {} {}'.format(
|
||||||
m.preferred_name,
|
m.preferred_name,
|
||||||
m.last_name,
|
m.last_name,
|
||||||
|
@ -166,11 +166,18 @@ def gen_search_strings():
|
||||||
)
|
)
|
||||||
|
|
||||||
string += ' | ' + m.user.email
|
string += ' | ' + m.user.email
|
||||||
string += ' | ' + m.discourse_username
|
|
||||||
|
if m.discourse_username:
|
||||||
|
string += ' | ' + m.discourse_username
|
||||||
|
|
||||||
string += ' | ' + str(m.id)
|
string += ' | ' + str(m.id)
|
||||||
|
|
||||||
|
for s in m.user.storage.all():
|
||||||
|
string += ' | ' + s.shelf_id
|
||||||
|
|
||||||
string = string.lower()
|
string = string.lower()
|
||||||
search_strings[string] = m.id
|
search_strings[string] = m.id
|
||||||
|
|
||||||
cache.set('search_strings', search_strings)
|
cache.set('search_strings', search_strings)
|
||||||
|
|
||||||
logger.info('Generated search strings in %s s.', time.time() - start)
|
logger.info('Generated search strings in %s s.', time.time() - start)
|
||||||
|
|
|
@ -99,9 +99,9 @@ class SearchViewSet(Base, Retrieve):
|
||||||
queryset = queryset.order_by('-vetted_date', '-id')
|
queryset = queryset.order_by('-vetted_date', '-id')
|
||||||
elif sort == 'newest_active':
|
elif sort == 'newest_active':
|
||||||
queryset = queryset.filter(paused_date__isnull=True)
|
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':
|
elif sort == 'newest_overall':
|
||||||
queryset = queryset.order_by('-application_date', '-id')
|
queryset = queryset.order_by('-current_start_date', '-id')
|
||||||
elif sort == 'oldest_active':
|
elif sort == 'oldest_active':
|
||||||
queryset = queryset.filter(paused_date__isnull=True)
|
queryset = queryset.filter(paused_date__isnull=True)
|
||||||
queryset = queryset.order_by('application_date', 'id')
|
queryset = queryset.order_by('application_date', 'id')
|
||||||
|
@ -1605,7 +1605,7 @@ class ProtocoinViewSet(Base):
|
||||||
|
|
||||||
memo = 'Protocoin - Purchase spent ₱ {} printing {}'.format(
|
memo = 'Protocoin - Purchase spent ₱ {} printing {}'.format(
|
||||||
total_cost,
|
total_cost,
|
||||||
request.data['job_name'],
|
request.data['job_name'][:100],
|
||||||
)
|
)
|
||||||
|
|
||||||
tx = models.Transaction.objects.create(
|
tx = models.Transaction.objects.create(
|
||||||
|
|
|
@ -198,6 +198,11 @@ function App() {
|
||||||
as={Link}
|
as={Link}
|
||||||
to='/classes'
|
to='/classes'
|
||||||
/>
|
/>
|
||||||
|
<Dropdown.Item
|
||||||
|
content='Storage'
|
||||||
|
as={Link}
|
||||||
|
to='/storage'
|
||||||
|
/>
|
||||||
<Dropdown.Item
|
<Dropdown.Item
|
||||||
content='Utilities'
|
content='Utilities'
|
||||||
as={Link}
|
as={Link}
|
||||||
|
|
|
@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
|
||||||
import { Link, useParams, useHistory } from 'react-router-dom';
|
import { Link, useParams, useHistory } from 'react-router-dom';
|
||||||
import './light.css';
|
import './light.css';
|
||||||
import { MembersDropdown } from './Members.js';
|
import { MembersDropdown } from './Members.js';
|
||||||
import { StorageList } from './Storage.js';
|
|
||||||
import { isAdmin, BasicTable, requester } from './utils.js';
|
import { isAdmin, BasicTable, requester } from './utils.js';
|
||||||
import { Button, Container, Form, Grid, Header, Message, Segment, Table } from 'semantic-ui-react';
|
import { Button, Container, Form, Grid, Header, Message, Segment, Table } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
@ -35,11 +34,6 @@ export function Debug(props) {
|
||||||
|
|
||||||
<p><Link to='/display/lcars2'>LCARS2 Display</Link></p>
|
<p><Link to='/display/lcars2'>LCARS2 Display</Link></p>
|
||||||
|
|
||||||
<Header size='medium'>Storage</Header>
|
|
||||||
|
|
||||||
<StorageList token={token} />
|
|
||||||
|
|
||||||
|
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -178,7 +178,7 @@ export function Members(props) {
|
||||||
<Container>
|
<Container>
|
||||||
<Header size='large'>Member List</Header>
|
<Header size='large'>Member List</Header>
|
||||||
|
|
||||||
<p>Search by name, email, Spacebar username, or member ID:</p>
|
<p>Search by name, email, Spacebar username, member ID, or member shelf:</p>
|
||||||
|
|
||||||
<Input autoFocus focus icon='search'
|
<Input autoFocus focus icon='search'
|
||||||
placeholder='Search...'
|
placeholder='Search...'
|
||||||
|
@ -250,7 +250,11 @@ export function Members(props) {
|
||||||
'None'
|
'None'
|
||||||
}
|
}
|
||||||
</Item.Description>
|
</Item.Description>
|
||||||
<Item.Description>Joined: {x.member.application_date || 'Unknown'}</Item.Description>
|
{sort === 'newest_active' ?
|
||||||
|
<Item.Description>Started: {x.member.current_start_date || 'Unknown'}</Item.Description>
|
||||||
|
:
|
||||||
|
<Item.Description>Joined: {x.member.application_date || 'Unknown'}</Item.Description>
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
</Item.Content>
|
</Item.Content>
|
||||||
|
|
|
@ -47,7 +47,6 @@ function EditStorage(props) {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [success, setSuccess] = useState(false);
|
const [success, setSuccess] = useState(false);
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const history = useHistory();
|
|
||||||
|
|
||||||
const handleSubmit = (e) => {
|
const handleSubmit = (e) => {
|
||||||
if (loading) return;
|
if (loading) return;
|
||||||
|
@ -69,25 +68,11 @@ function EditStorage(props) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveAndNext = (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
handleSubmit(e)
|
|
||||||
.then(res => {
|
|
||||||
setStorage(false);
|
|
||||||
history.push('/storage/' + (parseInt(id) + 1));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Header size='medium'>Edit Storage {storage.shelf_id}</Header>
|
<Header size='medium'>Edit Storage {storage.shelf_id}</Header>
|
||||||
|
|
||||||
<Form onSubmit={handleSubmit}>
|
<Form onSubmit={handleSubmit}>
|
||||||
<Form.Button floated='right' onClick={saveAndNext} loading={loading} error={error.non_field_errors}>
|
|
||||||
Save and edit next
|
|
||||||
</Form.Button>
|
|
||||||
|
|
||||||
<StorageEditor token={token} input={input} setInput={setInput} error={error} />
|
<StorageEditor token={token} input={input} setInput={setInput} error={error} />
|
||||||
|
|
||||||
<Form.Group widths='equal'>
|
<Form.Group widths='equal'>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user