cli: implement slabbedasker
This commit is contained in:
parent
1e3a24f575
commit
d678b1f525
@ -62,7 +62,7 @@ Run `poetry run worblehat --help` for more info
|
||||
- [ ] Ability to borrow and deliver multiple items at a time
|
||||
- [X] Ability to enter the queue for borrowing an item
|
||||
- [ ] Ability to extend a borrowing, only if no one is behind you in the queue
|
||||
- [ ] Ability to list borrowed items which are overdue
|
||||
- [X] Ability to list borrowed items which are overdue
|
||||
- [~] Ability to search for items
|
||||
- [ ] Ability to print PVV-specific labels for items missing a label, or which for any other reason needs a custom one
|
||||
- [X] Ascii art of monkey with fingers in eyes
|
||||
|
@ -171,6 +171,27 @@ class WorblehatCli(NumberedCmd):
|
||||
).cmdloop()
|
||||
|
||||
|
||||
def do_show_slabbedasker(self, _: str):
|
||||
slubberter = self.sql_session.scalars(
|
||||
select(BookcaseItemBorrowing)
|
||||
.join(BookcaseItem)
|
||||
.where(
|
||||
BookcaseItemBorrowing.end_time < datetime.now(),
|
||||
BookcaseItemBorrowing.delivered.is_(None),
|
||||
)
|
||||
.order_by(
|
||||
BookcaseItemBorrowing.end_time,
|
||||
),
|
||||
).all()
|
||||
|
||||
if len(slubberter) == 0:
|
||||
print('No slubberts found. Yay!')
|
||||
return
|
||||
|
||||
for slubbert in slubberter:
|
||||
print(f'{slubbert.username} - {slubbert.item.name} - {slubbert.end_time.strftime("%Y-%m-%d")}')
|
||||
|
||||
|
||||
def do_advanced(self, _: str):
|
||||
AdvancedOptionsCli(self.sql_session).cmdloop()
|
||||
|
||||
@ -216,14 +237,18 @@ class WorblehatCli(NumberedCmd):
|
||||
'doc': 'Show a bookcase, and its items',
|
||||
},
|
||||
4: {
|
||||
'f': do_show_slabbedasker,
|
||||
'doc': 'Show a slabbedasker, and their wicked ways',
|
||||
},
|
||||
5: {
|
||||
'f': do_save,
|
||||
'doc': 'Save changes',
|
||||
},
|
||||
5: {
|
||||
6: {
|
||||
'f': do_abort,
|
||||
'doc': 'Abort changes',
|
||||
},
|
||||
6: {
|
||||
7: {
|
||||
'f': do_advanced,
|
||||
'doc': 'Advanced options',
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user