commit 32ce1fb

default  ·  2023-05-29 07:12:19 +0000 UTC
parent 654e171
Close the question over due date in update_question().
1 files changed,  +10, -0
+10, -0
 1@@ -1038,6 +1038,16 @@ int update_question(snac *user, const char *id)
 2     /* update the list */
 3     msg = xs_dict_set(msg, xs_dict_get(msg, "oneOf") != NULL ? "oneOf" : "anyOf", nopts);
 4 
 5+    /* due date? */
 6+    const char *end_time = xs_dict_get(msg, "endTime");
 7+    if (!xs_is_null(end_time)) {
 8+        xs *now = xs_str_utctime(0, ISO_DATE_SPEC);
 9+
10+        /* it's now greater than the endTime? */
11+        if (strcmp(now, end_time) > 0)
12+            msg = xs_dict_set(msg, "closed", end_time);
13+    }
14+
15     /* store */
16     object_add_ow(id, msg);
17