{% extends "base.html" %} {% block title %}Categories & rules{% endblock %} {% macro rule_form(action, rule=None, submit="Add rule") %} {% set r = rule or {} %}
More options

When several rules match, the highest priority wins. Your own rules start at 20, above the starter rules.

{% if rule %}Cancel{% endif %}
{% endmacro %} {% macro pattern_view(rule) %} {% if rule.match_type == 'regex' and '|' in rule.pattern %} {% for part in rule.pattern.split('|') %}{{ part.replace('\\b', '').replace('^', '').replace('\\', '') }}{% endfor %} {% elif not rule.pattern %} any description {% else %} {{ MATCH_TYPES[rule.match_type] }} {{ rule.pattern }} {% endif %} {% endmacro %} {% block content %}

Categories & rules

Rules sort new transactions automatically. {{ rule_total }} rules across {{ categories|length }} categories.

{% for key, label in BUCKETS.items() %}

{{ label }}

{% if key == 'regular' %}Income and fixed bills.{% elif key == 'cash' %}Weekly cash, cash machines and transfers from your other account.{% elif key == 'investment' %}Money going into investments. Not counted as spending.{% else %}Everything else. Transactions with no category count here too.{% endif %}

{% for c in grouped[key] %}

{{ c.name }}

{{ tx_counts.get(c.id, 0) }} transaction{{ 's' if tx_counts.get(c.id, 0) != 1 }}
Edit
{% if c.bucket == 'investment' %} {% endif %}
{% set crules = by_category.get(c.id, []) %} {% if crules %}
    {% for rule in crules %}
  • {{ pattern_view(rule) }} {% if rule.direction != 'any' %}{{ DIRECTIONS[rule.direction]|lower }}{% endif %} {% if rule.tx_type %}type {{ rule.tx_type }}{% endif %}
    {{ matches.get(rule.id, 0) }} matched p{{ rule.priority }} Edit
  • {% endfor %}
{% else %}

No rules. Transactions get here when you choose this category yourself.

{% endif %}
{% else %}

No categories in this group.

{% endfor %}
{% endfor %}
{% endblock %}