Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/en/building/targets/targets-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ All targets are defined in the `targets.js` file as an array of objects accordin
| `context` | `string` | A string containing a JavaScript expression. This widget will only be shown if the expression evaluates to true. Details of the current user is available through the variable `user`. | no |
| `type` | `'count'` or `'percent'` | The type of the widget. | yes |
| `goal` | `integer` | For targets with `type: 'percent'`, an integer from 0 to 100. For `type: 'count'`, any positive number. If there is no goal, put -1. | yes |
| `limit_count_to_goal` | `boolean` | For `type: 'count'` targets with a goal, when `true` the displayed count is capped at the goal value when the actual count meets or exceeds the goal. The actual count is still recorded; only the display is affected. **Default: false** | no |
| `appliesTo` | `'contacts'` or `'reports'` | Do you want to count reports or contacts? This attribute controls the behavior of other attributes herein. | yes |
| `appliesToType` | If `appliesTo: 'reports'`, an array of form codes. If `appliesTo: 'contacts'`, an array of contact types. | Filters the contacts or reports for which `appliesIf` will be evaluated. For example, `['person']` or `['clinic', 'health_center']`. For example, `['pregnancy']` or `['P', 'pregnancy']`. | no |
| `appliesIf` | `function(contact, report)` | If `appliesTo: 'contacts'`, this function is invoked once per contact and `report` is undefined. If `appliesTo: 'reports'`, this function is invoked once per report. Return true to count this document. For `type: 'percent'`, this controls the denominator. | no |
Expand Down
2 changes: 2 additions & 0 deletions content/en/building/targets/targets-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Count widgets show a tally of a particular report that has been submitted or dat

A count without a goal displays a simple green number count. A count with a goal displays the value of the goal on the right side and a colored count in the center indicating progress towards achieving the goal. Progress is displayed in green if the count is equal to or above the goal, or in black if the count is below the goal.

When `limit_count_to_goal` is set to `true` in the target configuration, the displayed count is capped at the goal value once the actual count meets or exceeds it. This is useful when, for example, a CHW is paid based on completing a set number of visits — displaying a count above the goal may cause confusion. The actual count is still recorded; only the display is affected.

### Percent Widgets

{{< cards >}}
Expand Down
Loading