Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update view Timestamp logic to fix setAmendmentState problem #4412

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

reiterl
Copy link
Member

@reiterl reiterl commented Nov 27, 2024

Resolve #4303

Remove a strange distinct until changed timestamp logic which leads to failures in the issue.
I don't know, what the reason for this logic is, I think performance problems. So a whole test of the motion detail component is needed.

@reiterl reiterl added the bug label Nov 27, 2024
@reiterl reiterl added this to the 4.2 milestone Nov 27, 2024
Copy link
Member

@luisa-beerboom luisa-beerboom left a comment

Choose a reason for hiding this comment

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

The motion-change-recommendation-controller.service.ts there is a method getChangeRecosOfMotionObservable that has the exact same code. If this code is broken, that one should be as well. Please check that.
If the change recommendation code is also broken, the entire viewModelUpdateTimestamp logic can be removed. If not, Maybe reconsider whether this distinctUntilChanged is actually at fault

@reiterl
Copy link
Member Author

reiterl commented Nov 28, 2024

I have tested the change recommendation handling with the more then one crs. It worked fine.

@reiterl
Copy link
Member Author

reiterl commented Nov 28, 2024

I worked on fixing the update-timestamp at update, used the changedModels method for it. Test works.

@reiterl reiterl assigned luisa-beerboom and unassigned reiterl Nov 28, 2024
@reiterl
Copy link
Member Author

reiterl commented Nov 28, 2024

@luisa-beerboom Please look at the my new solution.

Copy link
Member

@luisa-beerboom luisa-beerboom left a comment

Choose a reason for hiding this comment

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

You should probably change the title of this PR

@luisa-beerboom luisa-beerboom removed their assignment Nov 28, 2024
@reiterl reiterl changed the title Rm strange, broken distinctUntilChanged timestamp logic Update view Timestamp logic to fix setAmendmentState problem Nov 28, 2024
Copy link
Member

@Elblinator Elblinator left a comment

Choose a reason for hiding this comment

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

This still doen't fix the Issue:
I created a motion with 8 paragraphs
and added 5 amendments (in paragraph 1,2,3,7 and 8)

  • Changing the first state sometimes works
  • Sometimes it updates after three amendment's states were changed
  • sometimes it updates if I reset all changes amendments to submitted

step to step reproduction:

  1. create motion with 200 words and 8 paragraphs (blindtextgenerator)
  2. Create 5 amendments (in line 1-2, 3-4, 5, 13-14 and 15), I deleted the first word for each amendment
  3. updating to the state to "accepted" or "not decided" (of any amendment) updates immediately, updating to "not decided" does not change the view automatically

(I called stop-dev and run-dev, the workflows are the default dev ones

@Elblinator Elblinator assigned reiterl and unassigned Elblinator Dec 2, 2024
@reiterl
Copy link
Member Author

reiterl commented Dec 3, 2024

@Elblinator showed me the problem on his computer. I build a small change, comparing the state_ids in the distinctUntil part.

@reiterl reiterl requested a review from Elblinator December 3, 2024 12:44
@reiterl reiterl assigned Elblinator and unassigned reiterl Dec 3, 2024
Copy link

@bspekker bspekker left a comment

Choose a reason for hiding this comment

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

functionality tested

@bspekker bspekker merged commit c8f70cb into OpenSlides:main Dec 4, 2024
3 checks passed
@reiterl reiterl deleted the 4303-amendment-controller-chnage branch December 4, 2024 10:38
Comment on lines +348 to +350
for (const viewModel of updatedViewModels) {
viewModel.viewModelUpdateTimestamp = Date.now();
}
Copy link
Member

@bastianjoel bastianjoel Dec 9, 2024

Choose a reason for hiding this comment

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

This is done on model level (line 729) in base-repository.ts. Doing it here again is unnecessary. Remove it.

@@ -47,7 +47,8 @@ export class AmendmentControllerService {
(prev, curr) =>
prev?.length === curr?.length &&
Math.max(...prev.map(e => e.viewModelUpdateTimestamp)) ===
Math.max(...curr.map(e => e.viewModelUpdateTimestamp))
Math.max(...curr.map(e => e.viewModelUpdateTimestamp)) &&
prev?.map(e => e.state_id).equals(curr?.map(e => e.state_id))
Copy link
Member

Choose a reason for hiding this comment

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

I guess the problem is, that entries get replaced by older entries while the array size stays the same. Probably it would be better to check for the ids of the entries.

                    prev?.map(e => e.id).equals(curr?.map(e => e.id))

Copy link
Member

Choose a reason for hiding this comment

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

Also this should be done in motion-change-recommendation-controller.service.ts too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Motion detail view with amendments: Changing amendment status needs reload
5 participants