Skip to content

Commit 894ee44

Browse files
committed
docs #4138 Document sequence fields and email logging
1 parent 5b28be3 commit 894ee44

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

docs/md/sequence-fields.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Sequence fields
2+
3+
We use several patterns across Janeway to let users set the sequence of things, most commonly with a `PositiveIntegerField`.
4+
5+
Because we sometimes expose this number to end users in form inputs, it is worth thinking about the usability of the default value. The number 1 is low enough to be easy for end users to manipulate. Zero is sometimes most convenient from a programming perspective, but avoid it if possible, since it can be counter-intuitive for non-programmers.
6+
7+
```py
8+
sequence = models.PositiveIntegerField(default=1)
9+
```
10+
11+
Of course, it is best if end users do not have to deal with this number at all. User interfaces should use accessible buttons that move things up or down in the sequence. This allows us to write an algorithm to check that multiple things have not been given the same sequence, and it keeps the user from having to recall off-screen information about the order of other items whilst performing an action.

docs/md/task-and-email-logs.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Task and email logs
2+
3+
Janeway creates a number of logs (`utils.LogEntry`) for actions that happen during the workflow. Many these actions trigger an email to be sent. The logging is thus managed by the email sending process. A log is created created that records the type of action taken in Janeway as well as details of the email.
4+
5+
## The notification system
6+
7+
The notification system, where emails and logs are created, lives in `src/utils`, and uses hooks to provide plugin functionality:
8+
9+
```
10+
src/utils/notify.py
11+
src/utils/notify_helpers.py
12+
src/utils/notify_plugins/notify_email.py
13+
src/utils/notify_plugins/email_log.py
14+
src/utils/notify_plugins/notify_slack.py
15+
```
16+
17+
<!--
18+
TODO
19+
* Document how the notify plugins work, exactly
20+
* Document when to use functions like send_email_with_body_from_user, etc.
21+
22+
-->
23+
24+
## Exceptions to action logging
25+
26+
There are exceptions to logging that are worth noting:
27+
28+
- Contact messages are not logged. Instead they are simply stored as objects.

0 commit comments

Comments
 (0)