Commit Graph

48 Commits

Author SHA1 Message Date
95d0537c69 feat(sales-summaries): refresh on a schedule, skipping accepted days
sales-summaries-v2 recomputes every dirty summary, but nothing set the dirty
flag on a schedule: mark-all-dirty was only ever called by hand from the
comment block, and the job was registered in neither server.clj's
INTEGREAT_JOB dispatch nor terraform/deploy.tf, so -main was dead code that
could never run in production. Summaries were only recalculated when someone
remembered to do it in the REPL, and POS data keeps arriving after a business
day closes, so a summary computed once on the day was routinely wrong and
stayed wrong.

Add a daily job that marks the trailing 7 days dirty and recomputes them,
leaving finished work alone. "Finished" is the condition the app already calls
Balanced -- debits equal credits and every line is mapped to an account. Since
that is derived rather than stored, a summary that later falls out of balance
is picked up again on the next run.

Extract the Balanced predicate into auto-ap.datomic.sales-summaries so the
grid's pill and the job share one definition, rather than a background job
requiring an SSR namespace. total-debits/total-credits resolve the ledger side
from either a plain keyword or the {:db/ident ...} map a pull returns, and
accepted? requires every item to declare a side: un-normalized pulled items
otherwise sum to 0.0 on both sides, read as balanced, and get skipped
silently and permanently.

Also fix sales-summaries-v2 destroying user-entered line items. It filtered
for :sales-summary-item/manual? to preserve them, but dirty-sales-summaries'
index-pull selector never fetched :sales-summary/items, so manual-items was
always empty. Because items is a component attribute upserted via
[:reset-rels ...], every recompute deleted the hand-entered lines -- often the
very lines that make a summary balance. Harmless while nothing ran on a
schedule; destructive the moment this does.

Register the job in the admin Background Jobs dropdown too, with a days
field: schedules are prod-only, so the admin page is the only way to run it
on staging.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-12 15:17:54 -07:00
4c14e43734 Greatly simplifies keeping bank accounts in check 2024-09-27 15:59:21 -07:00
85c0e21daf Fixes minor issue with sorting 2024-09-25 23:08:22 -07:00
4b36cde7a0 tweaks 2024-05-26 20:17:50 -07:00
f1cb203abc solr updates 2024-05-03 11:08:41 -07:00
3211635dce removing old square 2023-11-01 10:02:57 -07:00
Bryce
486c428917 Pregenerates recommendatios 2023-08-19 13:52:44 -07:00
Bryce
e2b67bde91 Makes usage of https for pdfs 2023-08-04 09:41:22 -07:00
Bryce
bb7ce74224 updated terraform 2023-05-22 23:29:04 -07:00
b200728c6a makes cloud search possible. 2023-05-04 17:07:08 -07:00
721596d6f9 merged 2023-05-01 17:10:34 -07:00
a292ee485c Fixes check width to be wider, fixes 1099 page 2023-05-01 15:48:29 -07:00
aca8f7c92c merged. 2023-04-27 11:33:54 -07:00
0f024f970b Added missing vendor 2023-04-27 09:25:53 -07:00
19d83f655f readiness for ntg automatic invoice importation 2023-04-26 14:26:49 -07:00
392b007920 (cloud) allows for automated restore. 2023-03-29 16:52:10 -07:00
b71095e44b Sets up ability to do backups from production 2023-03-28 12:40:23 -07:00
45ab9fe0af getting cloud working ok. 2023-03-24 10:57:53 -07:00
de8eb31493 Added the ability to load historcial sales yourself. 2022-12-04 20:04:35 -08:00
3e512a52ac adds register invoice import 2022-12-04 11:09:51 -08:00
58fad1b4f1 Adds the ability to sync ezcater orders every few hours 2022-12-04 10:11:44 -08:00
55e3df7e94 Makes new job for Brian 2022-09-30 23:19:15 -07:00
ae1500be9a Makes a whole separate page for recent jobs. 2022-09-30 16:30:11 -07:00
8774a3951c adds yodlee2 accounts 2022-09-30 08:34:13 -07:00
4042f367a7 Removes background worker :) 2022-09-28 05:35:28 -07:00
d430fb2f54 changes. 2022-09-26 20:34:46 -07:00
7d9dfcfeb1 Trying one final attempt 2022-09-23 13:27:05 -07:00
135d19c064 fix import 2022-09-23 12:17:05 -07:00
a9c3f74909 progress 2022-09-18 09:29:12 -07:00
5017d9bc67 splitting out background tasks 2022-09-18 06:51:17 -07:00
8b271e9e2a fix 2022-09-17 09:24:09 -07:00
7e23b1e89a small tweak. 2022-09-17 08:16:36 -07:00
4bcb2b7c53 statsd better approach 2022-09-17 06:59:41 -07:00
98f21bf3df New form of square loading. 2022-09-16 14:23:38 -07:00
f6758a850d test 2022-09-16 13:02:33 -07:00
8130f89d91 Making it possible to run one-off square 2022-09-15 09:20:17 -07:00
892674343d just minor terraform updates. 2022-07-09 07:50:47 -07:00
2f2d582a4b terraform tweaks to tear down staging right now 2022-07-08 06:32:09 -07:00
Bryce Covert
e7ae9e5df0 small tweaks to prep for staging environment. 2021-12-24 08:19:11 -08:00
Bryce Covert
dfc88602a0 Making terraform have no warnings 2021-12-24 08:10:20 -08:00
d8322bf498 Got terraform back up to date. 2021-12-18 17:10:04 -08:00
85df01e4bc trying to bump memory to make queries faster. 2021-07-20 22:03:40 -07:00
Bryce Covert
436e8fc912 image definitions. 2020-12-11 18:25:19 -08:00
Bryce Covert
173242f229 trying longer timeout 2020-12-09 11:43:01 -08:00
Bryce Covert
689cae6192 made web server not start background tasks. 2020-12-08 21:24:26 -08:00
Bryce Covert
99b6d822f6 performance optimization, much faster when only looking up check if transaction not found. 2020-12-08 20:43:27 -08:00
Bryce Covert
2c8213b18a lots of nice tweaks 2020-09-26 09:28:48 -07:00
Bryce Covert
efb6b76670 ta 2020-09-24 17:39:55 -07:00