# Expression Conditions ## Purpose Expression Conditions is a submodule of Bulletin expressions. Open a saved node in the [editor](/en/docs/bulletin-expression-editor) and click Manage conditions, or use that action in a root’s [library](/en/docs/bulletin-expressions) row menu. There is no separate conditions URL; the editor opens in a dialog. Conditions apply to a specific node and can return a result instead of its main expression. ## Working with the cascade 1. Add the first If rule. 2. Set the left and right expressions. For each, open the builder to select factors from the node’s expression, constants and related nodes. 3. Choose a comparison: =, !=, >, >=, <, <=. Use AND/OR for multiple comparisons. 4. Set a branch result: numeric expression or supported status. For more complex logic, add a nested branch instead of a regular result. 5. Add another If or an Otherwise. Drag normal rules to reorder. Otherwise acts as a fallback. The editor supports nesting up to a depth of 16. 6. Test with representative input. Click Save or Save and close. Use the rule navigator to move between branches. Additions, deletions and order persist when saving the whole condition tree. Saving an empty set clears previous conditions, leaving the main node expression. Closing without saving does not update the server. ## Evaluation priorities - Ordinary branches are evaluated from top to bottom; the first true one is selected. - When that branch has nested rules, evaluate those first. - Otherwise use its selected status, or, if no status, its numeric expression. - If no branch yields a result, use the main expression. If the first true branch contains a nested group that has no result, the evaluator falls back to the main expression rather than checking a later matching sibling. Otherwise is optional; without it, falling back to the main expression is normal. - Blank or erroneous conditions do not match. Invalid arithmetic may evaluate to zero. Supported performance-level results: `not-attended`, `not-permitted`, `unchecked`, `checked`, `need-clarification`, `excused-not-permitted`, `excused-not-attended`. These are special statuses, not numeric marks. The evaluator returns a separate status field; keep this distinction in mind if another formula expects a number. ## Example The primary expression combines two components. Suppose, for illustration, the institution requires a zero final mark when the exam is zero and continuous assessment is below 8. When the exam has the special Not attended status, return that status instead. Otherwise calculate the main formula. Put the special status check first and the two numeric comparisons second. For ordinary marks 12 and 18 weighted 0.4/0.6, the main formula returns 15.6. With Not attended, the first branch should apply. Verify that Require all factors does not block calculation when a status input has no numeric value: that gate runs before conditions. These are illustrative thresholds and statuses, not a prescribed grading policy. ### Testing The live test panel takes example marks and shows the evaluated path and result. Test boundary values, recorded zero, missing values, status branches and Otherwise. Compare with a test bulletin because local testing does not replace server interpretation of context and grading scale. ## Permissions, dependencies and limits Conditions are managed through the `bulletin-expression-conditions` module. Reading requires `bulletin-expression-conditions.index` and expression/factor/constant data. Saving the tree binds to `bulletin-expression-conditions.update`. Individual condition operations also have module CRUD permissions. There are no organizational scopes, but root approval locks still apply. The server rejects broken references and cycles. The conditions editor in journal transfer looks similar but uses different tokens and error handling; see [journal transfer rules](/en/docs/journal-transfer-rules). ## Implementation references - [Condition modal and saving](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/pages/AssessmentAndGrading/Conditions/components/ConditionsModal/index.tsx) - [Cascade editing](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/pages/AssessmentAndGrading/Conditions/components/ConditionsEditor/index.tsx) - [Condition branches](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/pages/AssessmentAndGrading/Conditions/components/RuleCard/index.tsx) - [Operators and supported status results](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/pages/AssessmentAndGrading/Conditions/types.ts) - [Local evaluation](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/pages/AssessmentAndGrading/Conditions/utils/evalEngine.ts) - [Condition permission routes](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/BulletinExpressions/routes/api.php) - [Condition tree validation](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/BulletinExpressions/Http/Requests/UpsertConditionTreeRequest.php) - [Condition persistence and reference checks](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/BulletinExpressions/Http/Services/ExpressionTreeUpsertService.php) - [Evaluation and fallback](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/BulletinExpressions/Http/Services/ExpressionEvaluatorService.php) - [Require all factors gate](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/Bulletins/Services/BulletinGradeCalculationService.php)