Merge pull request #446 from nowcommunity/docs-for-time-bound

add docs for time bound and update time unit docs
This commit is contained in:
Aaro Koivukangas
2024-11-01 12:01:49 +01:00
committed by GitHub
2 changed files with 21 additions and 6 deletions
+11
View File
@@ -0,0 +1,11 @@
### Time Bound
A Time Bound can be given the following information:
- Name (`b_name`)
- Age (`age`)
- A comment (`b_comment`)
The Name and Age fields are currently required by the validators, but the comment field is optional.
The Time Bound's detail view also has a tab for viewing which time units use the time bound.
+10 -6
View File
@@ -1,12 +1,16 @@
### Time Unit
When a user creates a new time unit, the following fields are needed:
A Time Unit can be given the following information:
- Name
- Sequence
- Lower Bound Id
- Upper Bound Id
- Name (`tu_display_name`)
- A Rank (`rank`)
- A comment (`tu_comment`)
- Sequence (`sequence`)
- Lower Bound Id (`low_bnd`)
- Upper Bound Id (`up_bnd`)
Out of these, the rank and comment fields are optional and the rest are required.
The components that are used to change the upper or lower time bounds are `TimeBoundSelection` components. These are almost exactly the same as `FieldWithTableSelection` components, but when their value is changed, they also update the `up_bound` and `low_bound` objects in `editData`. This way when the upper/lower bound id's are changed by the user, the actual bounds are immediately updated too and can be shown to the user or passed to a validator. `TimeBoundSelection` components should not be used anywhere else.
Changing a time unit's name causes a foreign key error in the database because the "now_time_unit" and "now_tau" tables are connected by it. When editing a time unit, the name field is currently disabled because of this.
After the time unit is created, its ID (`tu_name`) is set to be the same as its name, but lowercase (for example, a time unit with the name "Abdounian" has the id "abdounian"). Because of this, changing an existing time unit's name causes a foreign key error in the database because the "now_time_unit" and "now_tau" tables are connected by it. When editing a time unit, the name field is currently disabled to not allow this error to happen.