radboy 0.0.385__py3-none-any.whl → 0.0.387__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of radboy might be problematic. Click here for more details.

@@ -1,6 +1,44 @@
1
1
  from . import *
2
2
  import uuid
3
3
  class BhTrSa_Gui:
4
+
5
+ def next_saa(self):
6
+ with Session(ENGINE) as session:
7
+ now=datetime.now()
8
+ query=session.query(Scheduled_And_Appointments)
9
+ date_filtered_query=query.filter(or_(
10
+ and_(Scheduled_And_Appointments.StartDate!=None,Scheduled_And_Appointments.StartDate>=date(now.year,now.month,now.day)),
11
+ and_(Scheduled_And_Appointments.StartDateTime !=None,Scheduled_And_Appointments.StartDateTime>=datetime(now.year,now.month,now.day))
12
+ )
13
+ )
14
+
15
+ #ordered_query=date_filtered_query.order_by(Scheduled_And_Appointments.StartDate.asc(),Scheduled_And_Appointments.StartDateTime.asc())
16
+
17
+ most_recent_x=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"How many results(default=3)?:",helpText="an integer",data="integer")
18
+ if most_recent_x is None:
19
+ return
20
+ elif most_recent_x in ['d']:
21
+ most_recent_x=3
22
+
23
+ offset=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Offset to First, or Last, of Results by X(default=0):",helpText="an integer",data="integer")
24
+ if offset is None:
25
+ return
26
+ elif offset in ['d']:
27
+ offset=0
28
+
29
+ lu_state=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
30
+ if not lu_state:
31
+ ordered_query=date_filtered_query.order_by(Scheduled_And_Appointments.StartDate.asc(),Scheduled_And_Appointments.StartDateTime.asc())
32
+ else:
33
+ ordered_query=date_filtered_query.order_by(Scheduled_And_Appointments.StartDate.desc(),Scheduled_And_Appointments.StartDateTime.desc())
34
+ limited_query=ordered_query.limit(most_recent_x)
35
+ offset_query=limited_query.offset(offset)
36
+ results=offset_query.all()
37
+ ct=len(results)
38
+ for num,i in enumerate(results):
39
+ print(i.colorize(i,num,ct))
40
+
41
+
4
42
  def search_saa(self,returnable=False):
5
43
  display_past_due=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Display past due SAA's[False==Default]?",helpText="boolean yes or no[default]",data="boolean")
6
44
  if display_past_due is None:
@@ -10,29 +48,75 @@ class BhTrSa_Gui:
10
48
  else:
11
49
  display_past_due=True
12
50
 
13
- stext=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What are you looking for?",helpText="a textwise search",data="string")
51
+ most_recent_x=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Limit to First, or Last, of Results by X(default={sys.maxsize}):",helpText="an integer",data="integer")
52
+ if most_recent_x is None:
53
+ return
54
+ elif most_recent_x in ['d']:
55
+ most_recent_x=sys.maxsize
56
+
57
+ offset=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Offset to First, or Last, of Results by X(default=0):",helpText="an integer",data="integer")
58
+ if offset is None:
59
+ return
60
+ elif offset in ['d']:
61
+ offset=0
62
+
63
+ stext=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What are you looking for?",helpText="a textwise search, but may include saa_id",data="string")
14
64
  if stext in [None,]:
15
65
  return
16
66
  lu_state=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
17
67
  includes=["varchar","string","str","text"]
18
68
  sfields=[str(i.name) for i in BusinessHours.__table__.columns if str(i.type).lower() in includes]
19
69
  with Session(ENGINE) as session:
70
+ def mquery(lu_state,display_past_due,squery,offset,most_recent_x):
71
+ if not lu_state:
72
+ sorted_query=squery.order_by(Scheduled_And_Appointments.StartDate.asc(),Scheduled_And_Appointments.StartDateTime.asc(),Scheduled_And_Appointments.DTOE.asc())
73
+ else:
74
+ sorted_query=squery.order_by(Scheduled_And_Appointments.StartDate.desc(),Scheduled_And_Appointments.StartDateTime.desc(),Scheduled_And_Appointments.DTOE.desc())
75
+ now=datetime.now()
76
+ if not display_past_due:
77
+ sorted_query=sorted_query.filter(or_(
78
+ and_(Scheduled_And_Appointments.StartDate!=None,Scheduled_And_Appointments.StartDate>=date(now.year,now.month,now.day)),
79
+ and_(Scheduled_And_Appointments.StartDateTime !=None,Scheduled_And_Appointments.StartDateTime>=datetime(now.year,now.month,now.day))
80
+ )
81
+ )
82
+ else:
83
+ sorted_query=sorted_query.filter(or_(
84
+ and_(Scheduled_And_Appointments.StartDate!=None,Scheduled_And_Appointments.StartDate<=date(now.year,now.month,now.day)),
85
+ and_(Scheduled_And_Appointments.StartDateTime !=None,Scheduled_And_Appointments.StartDateTime<=datetime(now.year,now.month,now.day))
86
+ )
87
+ )
88
+ limited_query=sorted_query.offset(offset).limit(most_recent_x)
89
+
90
+ return limited_query
91
+
20
92
  query=session.query(Scheduled_And_Appointments)
21
- q=[]
22
- if stext != 'd':
23
- for i in sfields:
24
- q.append(getattr(Scheduled_And_Appointments,i).icontains(stext))
25
- squery=query.filter(or_(*q))
26
- else:
27
- squery=query
28
- if lu_state:
29
- sorted_query=squery.order_by(Scheduled_And_Appointments.DTOE.asc())
30
- else:
31
- sorted_query=squery.order_by(Scheduled_And_Appointments.DTOE.desc())
32
- now=datetime.now()
33
- if not display_past_due:
34
- sorted_query=sorted_query.filter(Scheduled_And_Appointments.StartDate>date(now.year,now.month,now.day))
35
- results=sorted_query.all()
93
+
94
+ def stage2(query,sfields,stext):
95
+ q=[]
96
+ if stext != 'd':
97
+ for i in sfields:
98
+ q.append(getattr(Scheduled_And_Appointments,i).icontains(stext))
99
+ squery=query.filter(or_(*q))
100
+ else:
101
+ squery=query
102
+ return squery
103
+
104
+ try:
105
+ print(stext)
106
+ if stext != 'd':
107
+ print(stext)
108
+ SAA_id=int(stext)
109
+ squery=query.filter(Scheduled_And_Appointments.saa_id==SAA_id)
110
+ else:
111
+ squery=stage2(query,sfields,stext)
112
+ squery=mquery(lu_state,display_past_due,squery,offset,most_recent_x)
113
+ except Exception as e:
114
+ print(f"{Fore.light_red}could not use '{stext}' as saa_id{Fore.light_steel_blue} this is not a failure{Style.reset}",e,repr(e))
115
+ squery=stage2(query,sfields,stext)
116
+ squery=mquery(lu_state,display_past_due,squery,offset,most_recent_x)
117
+
118
+ results=squery.all()
119
+ #sorted_query.all()
36
120
  ct=len(results)
37
121
  htext=[]
38
122
  if ct == 0:
@@ -421,15 +505,20 @@ class BhTrSa_Gui:
421
505
  'desc':"create a schedules and appointments entry"
422
506
  },
423
507
  uuid.uuid1():{
424
- 'cmds':['esaa','edit '],
508
+ 'cmds':['esaa','edit schedules and appointments'],
425
509
  'exec':self.edit_saa,
426
- 'desc':"edit a schedules and appointments entry"
510
+ 'desc':"edit a chedules and appointments entry"
427
511
  },
428
512
  uuid.uuid1():{
429
- 'cmds':['rmsaa','rm '],
513
+ 'cmds':['rmsaa','rm schedules and appointments'],
430
514
  'exec':self.rm_saa,
431
515
  'desc':"remove a schedules and appointments entry"
432
516
  },
517
+ uuid.uuid1():{
518
+ 'cmds':['nxt saa','next schedules and appointments'],
519
+ 'exec':self.next_saa,
520
+ 'desc':"display next x of schedules and appointments entry that are not past due"
521
+ },
433
522
  }
434
523
  htext=[]
435
524
  for cmd in cmds:
radboy/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION='0.0.385'
1
+ VERSION='0.0.387'
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: radboy
3
- Version: 0.0.385
3
+ Version: 0.0.387
4
4
  Summary: A small example package
5
5
  Author: Carl Joseph Hirner III
6
6
  Author-email: Carl Hirner III <k.j.hirner.wisdom@gmail.com>
@@ -5,7 +5,7 @@ radboy/Holidays.txt,sha256=y-JZPihh5iaWKxMIHNXD39yVuVmf1vMs4FdNDcg0f1Y,3114
5
5
  radboy/InventoryGlossary.txt,sha256=018-Yqca6DFb10jPdkUY-5qhkRlQN1k3rxoTaERQ-LA,91008
6
6
  radboy/RecordMyCodes.py,sha256=XXy-o5Z_yOgrgHNju4iqM3h7xhRBkNIoHG1qePtBnGY,41316
7
7
  radboy/Run.py,sha256=JUoCTHnzQBv7n8PB2_i93ANdAC_iW__RkAge8esCnk4,76
8
- radboy/__init__.py,sha256=eMJ_j4wKQLDuoOm_YEgC3q9tpmDHY5SL-p_P4-3H21g,17
8
+ radboy/__init__.py,sha256=ElGe-sPn1MK7i_sXEgxj8D0jCYsTxVvIfQHnTsnIxwE,17
9
9
  radboy/api_key,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  radboy/case-export-2024-05-14-13-10-00.672971.xlsx,sha256=Wd592d_VLFmfUI9KKKSVjNwjV91euc1T7ATyvwvUhlg,5431
11
11
  radboy/case-export-2024-05-14-13-13-22.540614.xlsx,sha256=OnGrhmScHfGp_mVaWW-LNMsqrQgyZDpiU3wV-2s3U5Q,5556
@@ -139,7 +139,7 @@ radboy/DayLog/TaxiFares.py,sha256=3slYjtBcTnRe8IeneJ-_iZJJ3E7alW09f6GWYXPxhOo,10
139
139
  radboy/DayLog/Wavelength4Freq.py,sha256=MfN2EATrN3bbEDgP1qOPjV1Fk8sVnkc_4tgX6sKfSE0,2054
140
140
  radboy/DayLog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
141
141
  radboy/DayLog/BhTrSa/__init__.py,sha256=q6xDsXAiWpQR2QWILKZKf--D3apR_KOE1CRbZaP7Vq4,976
142
- radboy/DayLog/BhTrSa/bhtrsaa.py,sha256=uRAHMHPihyOpwCvT1hd_VYvFReAWXXvXRaPmK4UBE4U,13975
142
+ radboy/DayLog/BhTrSa/bhtrsaa.py,sha256=pd7izQF79-BBshfS_HZ87WVoZv_hwMQHEwWMpvf3CWs,17945
143
143
  radboy/DayLog/__pycache__/DayLogger.cpython-311.pyc,sha256=TmRnRZHp5tMTokSEB8hWTxnasi-iJdh6TmYcb_nXGoY,29557
144
144
  radboy/DayLog/__pycache__/DayLogger.cpython-312.pyc,sha256=bfDCQZrIhgQYzoUle7roicRE_bhGPYZtIbCRIiDrsxU,68240
145
145
  radboy/DayLog/__pycache__/DayLogger.cpython-313.pyc,sha256=L3BYIw7SMXTsTK64KnTRg0mn-CRZn2Eq-4rjh75JXcs,151046
@@ -388,7 +388,7 @@ radboy/__pycache__/Run.cpython-311.pyc,sha256=G_UEfMtkLRjR6ZpGA_BJzGenuaCcP469Y9
388
388
  radboy/__pycache__/Run.cpython-312.pyc,sha256=v4xolc3mHyla991XhpYBUbBHYT0bnJ1gE-lkFoQ4GFA,241
389
389
  radboy/__pycache__/__init__.cpython-311.pyc,sha256=R-DVbUioMOW-Fnaq7FpT5F1a5p0q3b_RW-HpLRArCAY,242
390
390
  radboy/__pycache__/__init__.cpython-312.pyc,sha256=FsFzLXOlTK8_7ixoPZzakkR8Wibt-DvXLFh-oG2QlPw,164
391
- radboy/__pycache__/__init__.cpython-313.pyc,sha256=ygM5sZQQWeeFUaGoCymw9BaoubJhddD6gOISCLio2aI,165
391
+ radboy/__pycache__/__init__.cpython-313.pyc,sha256=7r3n21iLWvKxyFDntdNi3LXFQAXKE9Bdd2ms8TeaaLk,165
392
392
  radboy/__pycache__/__init__.cpython-39.pyc,sha256=D48T6x6FUeKPfubo0sdS_ZUut3FmBvPMP7qT6rYBZzU,275
393
393
  radboy/__pycache__/possibleCode.cpython-311.pyc,sha256=zFiHyzqD8gUnIWu4vtyMYIBposiRQqaRXfcT_fOl4rU,20882
394
394
  radboy/__pycache__/possibleCode.cpython-312.pyc,sha256=tk_CO-AcsO3YZj5j6vEsw3g37UmEzWc5YgeWEoJEUg4,27922
@@ -413,7 +413,7 @@ radboy/tkGui/Images/__pycache__/__init__.cpython-311.pyc,sha256=tXBYpqbOlZ24B1BI
413
413
  radboy/tkGui/__pycache__/BeginnersLuck.cpython-311.pyc,sha256=xLQOnV1wuqHGaub16mPX0dDMGU9ryCeLtNz5e517_GE,3004
414
414
  radboy/tkGui/__pycache__/Review.cpython-311.pyc,sha256=wKq24iM6Xe2OampgZ7-8U6Nvmgs2y-qWOrGwtWhc75k,4047
415
415
  radboy/tkGui/__pycache__/__init__.cpython-311.pyc,sha256=BX7DBn5qbvKTvlrKOP5gzTBPBTeTgSMjBW6EMl7N8e0,230
416
- radboy-0.0.385.dist-info/METADATA,sha256=0Kqja2tEl8KXG_UpyMI5IAHvvhl-530bDWkGTVSzcRY,794
417
- radboy-0.0.385.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
418
- radboy-0.0.385.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
419
- radboy-0.0.385.dist-info/RECORD,,
416
+ radboy-0.0.387.dist-info/METADATA,sha256=j1r6GKgm48XFB-Iwd_--U7xv-GL335QDhig2bUGE1LE,794
417
+ radboy-0.0.387.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
418
+ radboy-0.0.387.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
419
+ radboy-0.0.387.dist-info/RECORD,,