fsanyoto commited on
Commit
3ff1b1a
·
verified ·
1 Parent(s): 323cf74

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
Files changed (3) hide show
  1. RELEASES.json +1 -1
  2. VERSION +1 -1
  3. api/routes_grid.py +37 -8
RELEASES.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "current": "6a7bb2f",
3
  "releases": [
4
  {
5
  "version": "v62",
 
1
  {
2
+ "current": "1b2a445",
3
  "releases": [
4
  {
5
  "version": "v62",
VERSION CHANGED
@@ -1 +1 @@
1
- 6a7bb2f
 
1
+ 1b2a445
api/routes_grid.py CHANGED
@@ -1174,6 +1174,41 @@ def recurrence_preview(body: dict = Body(default=None),
1174
  # rule against a pid outside their cohort if they can name it. Booked rather than hidden.
1175
 
1176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1177
  def _record_recurrence_request(body):
1178
  """The three things every door below needs, validated once."""
1179
  body = body if isinstance(body, dict) else {}
@@ -1201,7 +1236,6 @@ def record_recurrence_read(body: dict = Body(default=None),
1201
  is answering with the COLUMN's, which is a different sentence from "no repeat" and the picker
1202
  renders it as one.
1203
  """
1204
- import aios_grid
1205
  from core import record_recurrence
1206
 
1207
  scope, pid, field_key = _record_recurrence_request(body)
@@ -1219,9 +1253,7 @@ def record_recurrence_read(body: dict = Body(default=None),
1219
  effective = stored if stored is not None else field.get("recurrence")
1220
  condition_fields = {str(item.get("key")) for item in fields
1221
  if isinstance(item, dict) and item.get("key")}
1222
- next_date = aios_grid.recurrence_row_next_date(
1223
- effective, body.get("anchorValue"), today=time.strftime("%Y-%m-%d"),
1224
- condition_fields=condition_fields) if isinstance(effective, dict) else None
1225
  return {"recurrence": effective if isinstance(effective, dict) else None,
1226
  "inherited": inherited, "nextDate": next_date}
1227
 
@@ -1240,7 +1272,6 @@ def record_recurrence_write(body: dict = Body(default=None),
1240
  the edit joins the undo stack and meets the field-permission check that already guards a typed
1241
  date. A second writer sitting outside those guards is the shape D-12 exists to refuse.
1242
  """
1243
- import aios_grid
1244
  from core import record_recurrence
1245
 
1246
  scope, pid, field_key = _record_recurrence_request(body)
@@ -1270,9 +1301,7 @@ def record_recurrence_write(body: dict = Body(default=None),
1270
  # ⚠ CLEARING A RECORD'S RULE FALLS BACK TO THE COLUMN'S, it does not fall back to nothing:
1271
  # the row is inheriting again, and answering `null` here would tell the picker the opposite.
1272
  effective = stored if stored is not None else field.get("recurrence")
1273
- next_date = aios_grid.recurrence_row_next_date(
1274
- effective, body.get("anchorValue"), today=time.strftime("%Y-%m-%d"),
1275
- condition_fields=condition_fields) if isinstance(effective, dict) else None
1276
  return {"recurrence": effective if isinstance(effective, dict) else None,
1277
  "inherited": stored is None, "nextDate": next_date}
1278
 
 
1174
  # rule against a pid outside their cohort if they can name it. Booked rather than hidden.
1175
 
1176
 
1177
+ def _record_next_date(recurrence, anchor_value, condition_fields):
1178
+ """The next date ONE record's rule names, with the empty-cell fallback this door owns.
1179
+
1180
+ ⭐⭐ THE CASE THAT SHIPPED BROKEN THE FIRST TIME, and it is the likeliest one there is: a
1181
+ person opens an EMPTY date cell and sets a repeat. `recurrence_row_next_date` answers `None`
1182
+ for an empty anchor, so the rule stored, the door answered `nextDate: null`, and the browser's
1183
+ `if (data.nextDate)` wrote nothing - the cell stayed empty, which is the owner's complaint
1184
+ verbatim. Found by driving the door against `anchorValue: null` on the deployed build.
1185
+
1186
+ ⛔ THIS DOES NOT OVERTURN W47-T25, AND THE DISTINCTION IS THE WHOLE ARGUMENT. That ruling
1187
+ forbids falling back to the FIELD-level `startDate`, because a field's rule is shared by every
1188
+ row and the fallback would hand a whole column the SAME date - "a column full of confident
1189
+ wrong values instead of an honestly empty one", in its own words. A PER-RECORD rule's
1190
+ `startDate` is `selectedIso`: the day THAT row's picker was showing when the person pressed
1191
+ Save. One row, one date, chosen by the person looking at it. The reason the ruling gives does
1192
+ not reach this case.
1193
+
1194
+ ⚠ THE COLUMN SWEEP IS UNTOUCHED. `recurrence_row_next_date` keeps its behaviour exactly, so
1195
+ `_materialise_recurrence_cells` and the nightly roll-forward still answer empty for an empty
1196
+ anchor. The fallback lives HERE, on the per-record door, and nowhere else.
1197
+ """
1198
+ import aios_grid
1199
+
1200
+ if not isinstance(recurrence, dict):
1201
+ return None
1202
+ today = time.strftime("%Y-%m-%d")
1203
+ answer = aios_grid.recurrence_row_next_date(
1204
+ recurrence, anchor_value, today=today, condition_fields=condition_fields)
1205
+ if answer or str(anchor_value or "").strip():
1206
+ return answer
1207
+ return aios_grid.recurrence_row_next_date(
1208
+ recurrence, recurrence.get("startDate"), today=today,
1209
+ condition_fields=condition_fields)
1210
+
1211
+
1212
  def _record_recurrence_request(body):
1213
  """The three things every door below needs, validated once."""
1214
  body = body if isinstance(body, dict) else {}
 
1236
  is answering with the COLUMN's, which is a different sentence from "no repeat" and the picker
1237
  renders it as one.
1238
  """
 
1239
  from core import record_recurrence
1240
 
1241
  scope, pid, field_key = _record_recurrence_request(body)
 
1253
  effective = stored if stored is not None else field.get("recurrence")
1254
  condition_fields = {str(item.get("key")) for item in fields
1255
  if isinstance(item, dict) and item.get("key")}
1256
+ next_date = _record_next_date(effective, body.get("anchorValue"), condition_fields)
 
 
1257
  return {"recurrence": effective if isinstance(effective, dict) else None,
1258
  "inherited": inherited, "nextDate": next_date}
1259
 
 
1272
  the edit joins the undo stack and meets the field-permission check that already guards a typed
1273
  date. A second writer sitting outside those guards is the shape D-12 exists to refuse.
1274
  """
 
1275
  from core import record_recurrence
1276
 
1277
  scope, pid, field_key = _record_recurrence_request(body)
 
1301
  # ⚠ CLEARING A RECORD'S RULE FALLS BACK TO THE COLUMN'S, it does not fall back to nothing:
1302
  # the row is inheriting again, and answering `null` here would tell the picker the opposite.
1303
  effective = stored if stored is not None else field.get("recurrence")
1304
+ next_date = _record_next_date(effective, body.get("anchorValue"), condition_fields)
 
 
1305
  return {"recurrence": effective if isinstance(effective, dict) else None,
1306
  "inherited": stored is None, "nextDate": next_date}
1307