Skip to content

Implement global measures#1345

Open
Jogius wants to merge 48 commits intodev-nextfrom
feature/measures
Open

Implement global measures#1345
Jogius wants to merge 48 commits intodev-nextfrom
feature/measures

Conversation

@Jogius
Copy link
Copy Markdown
Contributor

@Jogius Jogius commented Mar 27, 2026

Summary

Closes #1350.

This PR aims to implement (global) measures by

  1. Adding the datamodels for MeasureProperty, MeasureTemplate and Measure
  2. Implementing execution logic for the properties
  3. Hardcoding couple of basic measure templates
  4. Adding UI for participants to execute measures

Measures_v2

Also

PR Checklist

Please make sure to fulfil the following conditions before marking this PR ready for review:

  • If this PR adds or changes features or fixes bugs, this has been added to the changelog
  • If this PR adds new actions or other ways to alter the state, test scenarios have been added.
  • By signing off my commits (git commit -s), I certify that I have read and adhere to the terms of the Developer Certificate of Origin 1.1 and license the code in this Pull Request under this projects license (LICENSE-README.md).
  • If I have used third party code that requires attribution, I have mentioned it in the code and updated inspired-by-or-copied-from-list.html.

@Jogius Jogius self-assigned this Mar 27, 2026
@Jogius Jogius force-pushed the feature/measures branch from 11f8ae8 to 1e55856 Compare March 27, 2026 15:21
@fekoch
Copy link
Copy Markdown
Contributor

fekoch commented Mar 29, 2026

I like the way of having the measures in an out-of-view menu. (This delays confronting trainees with all available measures.) Also the placement seems like a good fit.

Some thoughts for now:

  • You should extend the expansion button using a descriptive text "Maßnahmen".
  • We should try the UI on both a large smart board and a tablet to get a better feel for it.
  • Some kind of feedback is needed, that a measure is going to be executed.
  • As trainer, I want to see that there are measures available.
  • As a trainer, I want to enable or disable this feature in the exercise settings. (EDIT @hansegucker: Already covered by data model.)
  • I do not get the purpose of the title text? And I can not think of a future use for it.

A thought for the future:

  • For non-parallel exercises with multiple participants, measures could still be useful but maybe need to be enabled/disabled one-by-one on each view port separately.

@hansegucker
Copy link
Copy Markdown
Contributor

hansegucker commented Mar 29, 2026

I mostly agree with @fekoch, but additionally I would consider the following things

  • I think the buttons for measures that should only contain one area with text in one font size.
  • The buttons are little bit flaky (I am not sure why).
  • We probably shouldn't use the toasts as indicator for the measure delay.

@Jogius
Copy link
Copy Markdown
Contributor Author

Jogius commented Mar 30, 2026

@fekoch

Some kind of feedback is needed, that a measure is going to be executed.

I was thinking about this too. I temporarily added a toast when a measure is executed and aborted, but this feels very spammy. I personally think we don't need a generic feedback, because most measures will trigger some behavior -- we could e.g. enforce that a measure always has at least one property which triggers UI, like a manual confirmation, which would make this obsolete.

@hansegucker

We probably shouldn't use the toasts as indicator for the measure delay.

Discussion question: should the user get feedback on the delay / should they know how long they have to wait?

@Jogius Jogius force-pushed the feature/measures branch 4 times, most recently from 56ad713 to a6d57b9 Compare April 9, 2026 13:18
@Jogius Jogius force-pushed the feature/measures branch 2 times, most recently from 935d5a8 to 163596c Compare April 16, 2026 14:14
@Jogius Jogius marked this pull request as ready for review April 16, 2026 14:16
@Jogius Jogius force-pushed the feature/measures branch from 163596c to dee842e Compare April 16, 2026 14:17
@Jogius Jogius requested a review from JohannesPotzi April 20, 2026 13:33
Copy link
Copy Markdown
Contributor

@JohannesPotzi JohannesPotzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mini initial review. More to come.

@fekoch fekoch self-requested a review April 21, 2026 15:56
Copy link
Copy Markdown
Contributor

@fekoch fekoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(some first things)

@Jogius Jogius changed the title Implement (global) measures base Implement global measures Apr 22, 2026
@Jogius Jogius changed the base branch from dev to dev-next April 23, 2026 06:42
Signed-off-by: Julius Makowski <[email protected]>
@Jogius Jogius requested a review from fekoch April 23, 2026 15:21
Signed-off-by: Julius Makowski <[email protected]>
Copy link
Copy Markdown
Contributor

@fekoch fekoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partial review for the shared directory

Comment thread shared/src/store/action-reducers/drawing.ts
Comment thread shared/src/models/drawing.ts Outdated
Comment thread shared/src/models/drawing.ts Outdated
Comment thread shared/src/models/drawing.ts
Comment thread shared/src/store/action-reducers/utils/measures.ts Outdated
Comment thread shared/src/store/action-reducers/measure-templates.ts Outdated
Comment thread shared/src/models/measure/instances.ts
Comment thread shared/src/store/action-reducers/drawing.ts
function sendAlarmGroupVehicle(
draftState: WritableDraft<ExerciseState>,
vehicleParameters: VehicleParameters,
vehicleParameters: Immutable<VehicleParameters>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make VehicleParameters always immutable instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not touch this in this PR. I don't know where this comes from.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is already there on dev-next, just clean it up when merging

Comment thread shared/src/models/measure/instances.ts Outdated
Comment thread shared/src/models/measure/instances.ts Outdated
Comment thread shared/src/models/measure/properties.ts Outdated
Comment thread shared/src/store/action-reducers/utils/log.ts Outdated
}
);
break;
case 'drawingInstance':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we not have to also do the [Drawing] Add drawing action?
If the frontend independently proposes that, but not the addLogEntry actions, this seems very inconsitent to me

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that we want the drawings to be displayed before the measure is finally executed -- such that the user who is creating the drawing can see it before confirming/declining if there are more properties after the drawing, and also potential other participants and trainers can see this while it's being done.
While we could implement this for all other measure properties (i.e. creating an EOC log entry) as well, I found that drawings were more of an exception to the rule. Happy to discuss this though.

I had previously implemented for all drawings to be removed again and re-created by the Add Measure reducer, but this did not make any sense since it just added one more action and the state is exactly the same afterwards with both approaches.

Copy link
Copy Markdown
Contributor

@fekoch fekoch May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robert and I talked a bit: One (albeit a bit more involved) way would be, to track draftDrawings as a observable inside the drawing service and, after injecting the service into the drawing feature manager, combine it's observable with the selectVisibleDrawings()-observable from the store.

That way, we could prevent prematurely sending actions about unfinished drawings.

But this could also be treated as future work.

Comment thread frontend/src/app/state/application/selectors/exercise.selectors.ts Outdated
@Jogius Jogius force-pushed the feature/measures branch from f24e817 to ed22bbe Compare April 29, 2026 09:11
@hansegucker
Copy link
Copy Markdown
Contributor

Global measures don't work in fullscreen.

@hansegucker hansegucker closed this May 6, 2026
@hansegucker hansegucker reopened this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Increase Thickness of Stroke for Draw-Line-Measure Global Measures

4 participants