Skip to content

Commit 4000069

Browse files
committed
Updates rules to match code
1 parent 39d728f commit 4000069

File tree

9 files changed

+87
-18
lines changed

9 files changed

+87
-18
lines changed

INIT.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Constructor/initializer testing locations
2+
- spec/domain/projects/project_spec.rb:35 (defaults description to empty string)
3+
- spec/domain/projects/project_spec.rb:45 (defaults point_of_contact to empty string)
4+
- spec/domain/projects/project_spec.rb:74 (defaults archived to false)
5+
- spec/domain/projects/project_spec.rb:98 (defaults current_state to :new)
6+
- spec/domain/projects/project_spec.rb:104 (invalid when initialized with invalid state)
7+
- spec/domain/teams/team_spec.rb:34 (defaults description to empty string)
8+
- spec/domain/teams/team_spec.rb:44 (defaults point_of_contact to empty string)
9+
- spec/domain/teams/team_spec.rb:59 (defaults archived to false)
10+
- spec/domain/initiatives/initiative_spec.rb:34 (defaults description to empty string)
11+
- spec/domain/initiatives/initiative_spec.rb:44 (defaults point_of_contact to empty string)
12+
- spec/domain/initiatives/initiative_spec.rb:59 (defaults archived to false)
13+
- spec/domain/initiatives/initiative_spec.rb:69 (defaults current_state to :new)
14+
- spec/domain/initiatives/initiative_spec.rb:79 (converts string state to symbol)
15+
- spec/domain/initiatives/initiative_spec.rb:86 (invalid when state is not allowed)
16+
- spec/presenters/health_presenter_spec.rb:6 (describe #initialize)
17+
- spec/presenters/confidence_presenter_spec.rb:6 (describe #initialize)
18+
- spec/presenters/trend_presenter_spec.rb:6 (describe #initialize)

NIL.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Explicit return nil
2+
- lib/domain/teams/team.rb:43
3+
- lib/domain/teams/team.rb:98
4+
- lib/domain/support/health_rollup.rb:43
5+
- lib/domain/projects/project_health.rb:38
6+
- lib/domain/projects/project_health.rb:44
7+
- app/controllers/projects_controller.rb:301
8+
- app/persistence/health_update_repository.rb:74
9+
- app/persistence/health_update_repository.rb:77
10+
- app/persistence/initiative_repository.rb:10
11+
- app/persistence/team_repository.rb:10
12+
- app/persistence/project_repository.rb:15
13+
- app/persistence/project_repository.rb:186
14+
- app/presenters/initiative_header_presenter.rb:42
15+
- app/presenters/team_edit_modal_presenter.rb:29
16+
- app/presenters/initiative_edit_modal_presenter.rb:29
17+
18+
Conditional or ternary returning nil
19+
- lib/domain/teams/team.rb:112
20+
- app/controllers/dashboard_controller.rb:200
21+
- app/controllers/initiatives_controller.rb:197
22+
- app/controllers/teams_controller.rb:192
23+
- app/persistence/health_update_repository.rb:37
24+
- app/persistence/project_repository.rb:180
25+
- app/persistence/project_repository.rb:189
26+
- app/persistence/team_repository.rb:178
27+
- app/presenters/team_header_presenter.rb:31
28+
- app/presenters/team_header_presenter.rb:32
29+
- app/presenters/team_header_presenter.rb:33
30+
- app/presenters/team_header_presenter.rb:35
31+
- app/presenters/team_section_item_presenter.rb:22

TODO.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## SMALL THINGS
44
* [x] Use zen logo on home page
5+
* [x] Are Archived projects being inluded in health? NO
56
* [ ] Sticky header not working
67
* [ ] Health update hit text highly recommended
78
* [ ] Spacing beneath search dropdown is too much
@@ -14,9 +15,16 @@
1415
* [ ] Projects section should match all other pages
1516
* [ ] Improve tab stops everwhere.
1617
* [ ] State should not include New
17-
* [ ] Are Archived projects being inluded in health?
18+
* [ ] Should archived be a state rather than a boolean?
19+
* [ ] Review opportunities for null objects in NIL.md
20+
* [ ] Review opportunities to remove specs that test constructors in INIT.md
1821

1922
## FEATURE IDEAS
23+
* [ ] Project filters
24+
* [ ] All
25+
* [ ] What's going well
26+
* [ ] What needs leadership attention (at risk / off track / blocked / unowned)
27+
* [ ] What needs management attention (stale)
2028
* [ ] Executive summary
2129
* [ ] People with contact fields
2230
* [ ] Personal dashboard / check in
@@ -32,11 +40,6 @@
3240
* [ ] Critical projects
3341
* [ ] 2x weight
3442
* [ ] Requires comment to enable
35-
* [ ] Project filters
36-
* [ ] All
37-
* [ ] What's going well
38-
* [ ] What needs leadership attention (at risk / off track / blocked / unowned)
39-
* [ ] What needs management attention (stale)
4043

4144
## DUMB IDEAS
4245
* [ ] Add randomly rotating taglines
@@ -125,4 +128,20 @@ Executive Summary View (one screen)
125128

126129
## Teams
127130
* Array to score = direct child teams + average of direct owned projects
128-
* Score = average of health scores
131+
* Score = average of health scores
132+
133+
134+
# Health & Health Scores
135+
136+
Currently, HealthUpdates store a string. They should record a number. It would save a bunch of conversions.
137+
138+
* HEALTH_SCORES = { on_track: 1, at_risk: 0, off_track: -1 }
139+
* HEALTH_THRESHOLDS = { on_track: 0.5, off_track: -0.5 }
140+
141+
ProjectHealth
142+
InitiativeHealth
143+
TeamHealth
144+
- All three use HealthScore
145+
146+
HealthScore
147+
- Calculates scores and returns the appropriate characterizations of the scores

rules/domain/initiatives/initiative.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
An Initiative represents a strategic effort composed of projects.
22

33
Identifiers and attributes
4-
- `name` is required and globally unique.
4+
- `name` is required and unique among initiatives.
55
- `description` and `point_of_contact` are optional strings defaulting to `''`.
66
- `archived` defaults to false and is exposed via `archived?`.
77

@@ -10,9 +10,10 @@ Structure and ordering
1010
- Initiatives may only relate to top-level (parentless) projects; child projects cannot be related to initiatives.
1111

1212
Health model
13-
- Uses health rollup scoring (`:on_track => 1`, `:at_risk => 0`, `:off_track => -1`; thresholds >0 `:on_track`, <0 `:off_track`, else `:at_risk`); `:not_available` related project health is ignored.
13+
- Uses health rollup scoring (`:on_track => 1`, `:at_risk => 0`, `:off_track => -1`; thresholds >0.5 `:on_track`, <=-0.5 `:off_track`, else `:at_risk`); `:not_available` related project health is ignored.
1414
- Current health is the rollup average of related projects whose `current_state` is `:in_progress` or `:blocked`.
1515
- Related projects in other states are ignored.
16+
- Archived related projects are ignored.
1617
- If no related projects are in a working state, health is `:not_available`.
1718

1819
Validation
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Action: UpdateInitiative
22
- Purpose: replace an existing Initiative in the InitiativeRepository with a new instance.
3-
- Inputs: initiative id; initiative attributes (`name`, optional `description`, optional `point_of_contact`, archived flag, loaders as needed).
3+
- Inputs: initiative id; initiative attributes (`name`, optional `description`, optional `point_of_contact`, archived flag).
44
- Failures: initiative not found; new initiative invalid; new initiative name conflicts with an existing Initiative.
55
- Success: returns Result.success with the updated Initiative persisted.

rules/domain/projects/create_subordinate_project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Action: CreateSubordinateProject
22
- Purpose: create a new Project and append it to a parent Project’s children sorted set (as last).
33
- Inputs: parent project id; project attributes (`name`, optional `description`, optional `point_of_contact`).
44
- Constraints: the created child is attached to exactly one parent project; ordering is maintained within the parent’s set.
5-
- Failures: project invalid; project name conflicts with any existing Project (error text: `"team name must be unique"`).
5+
- Failures: project invalid; project name conflicts with any existing Project (error text: `"project name must be unique"`).
66
- Success: returns Result.success with the created Project; persists the Project and parent-child relationship with order at the end of the parent’s set.

rules/domain/projects/project.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
A Project is the central unit of work.
22

33
Identifiers and attributes
4-
- `name` is required and globally unique.
4+
- `name` is required and unique among projects.
55
- `description` and `point_of_contact` are optional strings defaulting to `''`.
66
- `archived` defaults to false and is exposed via `archived?`.
77

@@ -14,8 +14,8 @@ Structure and ordering
1414

1515
State model
1616
- Allowed states: `:new, :todo, :in_progress, :blocked, :on_hold, :done`.
17-
- Only `SetProjectState` mutates state values.
18-
- Leaf projects store `current_state` directly; any state can transition to any other state.
17+
- `SetProjectState` mutates state values; `SetInitiativeState` can also cascade state to related projects.
18+
- Leaf projects store `current_state` directly; leaf projects can be set to any state except `:new`.
1919
- Parent projects derive `current_state` from their leaf descendants via rollup; stored state is ignored.
2020
- State rollup priority (highest to lowest): `:blocked, :in_progress, :on_hold, :todo, :new, :done`.
2121
- If any leaf is `:blocked`, parent state is `:blocked`.
@@ -30,11 +30,11 @@ Health model
3030
- Health enum: `:not_available, :on_track, :at_risk, :off_track`.
3131
- Health updates (value objects) hold `project_id, date, health, description?`; loaded lazily.
3232
- Weekly health updates are a lazily loaded subset for trends.
33-
- Health scoring for rollups: `:on_track => 1`, `:at_risk => 0`, `:off_track => -1`; averages map back via thresholds (>0 `:on_track`, <0 `:off_track`, else `:at_risk`). Subordinate health of `:not_available` is ignored.
33+
- Health scoring for rollups: `:on_track => 1`, `:at_risk => 0`, `:off_track => -1`; averages map back via thresholds (>0.5 `:on_track`, <=-0.5 `:off_track`, else `:at_risk`). Subordinate health of `:not_available` is ignored; archived and non-working-state children are excluded.
3434
- Current health calculation:
3535
- If subordinate projects exist, health is the rollup average of subordinate current health. Subordinates with `:not_available` health are ignored. If all subordinates have `:not_available` health, health is `:not_available`.
3636
- If no subordinate projects (leaf), use health updates: `:not_available` when none exist; otherwise the health of the latest update by date.
37-
- Health trend: the last 6 weekly updates plus current health; empty when no updates exist.
37+
- Health trend: the last 6 weekly updates plus current health; when no updates exist, returns a single current entry with `:not_available`.
3838

3939
Validation
4040
- `valid?` requires present `name` and allowed state; exposes `errors` explaining failures.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Action: UpdateProject
22
- Purpose: replace an existing Project in the ProjectRepository with a new instance.
3-
- Inputs: project id; project attributes (`name`, optional `description`, optional `point_of_contact`, optional `current_state`, optional archived flag, loaders as needed).
3+
- Inputs: project id; project attributes (`name`, optional `description`, optional `point_of_contact`, optional archived flag).
44
- Failures: project not found; new project invalid; new project name conflicts with an existing Project.
55
- Success: returns Result.success with the updated Project persisted.

rules/domain/teams/team.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
A Team represents a group of people working together.
22

33
Identifiers and attributes
4-
- `name` is required and globally unique.
4+
- `name` is required and unique among teams.
55
- `description` and `point_of_contact` are optional strings defaulting to `''`.
66
- `archived` defaults to false and is exposed via `archived?`.
77

0 commit comments

Comments
 (0)