Skip to content

Meetings merge minutes and close actions#7968

Merged
leio10 merged 25 commits intodevelopfrom
7285-meetings-merge-minutes-and-close-actions
May 28, 2021
Merged

Meetings merge minutes and close actions#7968
leio10 merged 25 commits intodevelopfrom
7285-meetings-merge-minutes-and-close-actions

Conversation

@entantoencuanto
Copy link
Copy Markdown
Contributor

@entantoencuanto entantoencuanto commented May 7, 2021

🎩 What? Why?

  • Migrates the minutes model attributes to meetings.
  • Removes the minutes management from admin panel and moves the management of the new meeting attributes related with minutes to the close action
  • Changes the front to display correct minutes attributes
  • Copies existing minutes descriptions into closing reports when previous closing report was blank
  • Closes automatically meetings if minutes data is present
  • If a meeting was closed but there were no minutes attributes the migration sets closing_visible to true to display closing values as before.
  • Extends closing_visible behavior to hide all closing attributes
  • Changes API response to send minutes attributes in the meeting request response
  • Removes minutes model and related API type. The migration to remove minutes table also changes the Decidim::ActionLog instances to avoid errors (see 55107b2 for more details)

📌 Related Issues

Link your PR to an issue

Testing

Describe the best way to test or validate your PR.

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

📷 Screenshots

Please add screenshots of the changes you're proposing
Description

♥️ Thank you!

@entantoencuanto entantoencuanto force-pushed the 7285-meetings-merge-minutes-and-close-actions branch 2 times, most recently from 4d4d1aa to 6546013 Compare May 7, 2021 21:22
@entantoencuanto entantoencuanto marked this pull request as ready for review May 12, 2021 19:11
@entantoencuanto entantoencuanto force-pushed the 7285-meetings-merge-minutes-and-close-actions branch 2 times, most recently from 04471b0 to a61aabd Compare May 19, 2021 09:28
@leio10
Copy link
Copy Markdown
Contributor

leio10 commented May 24, 2021

@entantoencuanto Hi! Is this PR ready to be reviewed?

The migration also changes existing action_log entries (and associated
version) associated with minutes to point to the meeting instance
instead of a minutes instance. This avoids errors once the table and
model are deleted
This migration:

* Changes renames minutes_visible with closing_visible
  which is going to be extended to all closing attributes.
* Removes minutes_description column copies it before into
  closing_report if blank.
* Closes meetings when minutes attributes exist if not closet yet.
* If a meeting is closed but there are no minutes attributes the
  migration sets closing_visible to true to display closing values as
  before.
… removal

* Extends closing_visible behavior to hide all closing attributes
* Change admin form to manage close and minute attributes in only one
  section
* Changes API response to remove minutes_description reference and hide
  all close attributes when closing_visible sets it
* Updates some tests
@entantoencuanto entantoencuanto force-pushed the 7285-meetings-merge-minutes-and-close-actions branch from 964fa37 to 719aac4 Compare May 26, 2021 14:55
@entantoencuanto
Copy link
Copy Markdown
Contributor Author

@entantoencuanto Hi! Is this PR ready to be reviewed?

Oh, yes, I've resolved some conflicts rebasing, but I think it's ready. Sorry for the delay in responding

@entantoencuanto
Copy link
Copy Markdown
Contributor Author

I've seen a small change commented in the issue, I'll add a commit reordering meeting show view

@leio10 leio10 added module: meetings type: change PRs that implement a change for an existing feature labels May 27, 2021
Copy link
Copy Markdown
Contributor

@leio10 leio10 left a comment

Choose a reason for hiding this comment

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

Great job, especially with the documentation and the data migration! I've added a few comments, let's address them and we can merge this PR.

field :video_url, GraphQL::Types::String, "URL for the video of the session, if any", null: true
field :audio_url, GraphQL::Types::String, "URL for the audio of the session, if any", null: true
# probably useful in the future, when handling user permissions
# field :closing_visible, !types.Boolean, "Whether this minutes is public or not", property: :visible
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.

Do we need to keep this commented code? I'd prefer to remove it and add it in the future when needed. 😬


private

def minutes_class
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.

There is any reason to create this class dynamically? It would be possible to define a static class instead of using a method?

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.

No, there is no special reason to define class dynamically, I'll use a static class instead

end

def down
Decidim::Meetings::Meeting.find_each do |meeting|
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.

I'm trying to reduce the errors during data migrations, so I recommend you not to load model instances in that context. In this discussion you can find a clear list of alternatives to fix it.

Also, I encourage you to add feedback if you find any error or possible improvement in the proposed solutions.

"TmpMinutes"
end

belongs_to :meeting, foreign_key: "decidim_meeting_id", class_name: "Decidim::Meetings::Meeting"
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.

We can apply the data migration rules also for the class_name attribute.


class DropDecidimMeetingsMinutesTable < ActiveRecord::Migration[6.0]
def up
Decidim::ActionLog.where(resource_type: "Decidim::Meetings::Minutes").each do |action_log|
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.

We can apply the data migration rules here. Maybe you need to add the Traceable concern to the new ActionLog class.

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.

In this case I have not needed the Traceable concern to update the action_log entries

t.timestamps
end

Decidim::Meetings::Meeting.find_each do |meeting|
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.

We can apply the data migration rules here.

meeting.minutes_description.blank? || meeting.minutes_description.is_a?(Hash) && meeting.minutes_description.values.all?(&:blank?)
end

def minutes_class
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.

Same questions as before, is there any reason to define this class dinamically?


class MergeMinutesWithClosingReportInMeetingsTable < ActiveRecord::Migration[6.0]
def up
Decidim::Meetings::Meeting.find_each do |meeting|
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.

We can apply the data migration rules here. In fact, I think that if you define a new class for Meeting you could use the attributes and call meeting.save! as the last statement for the loop and remove the calls to update_attribute.

CHANGELOG.md Outdated
* If there was minutes data and the meeting was not closed, the meeting is closed and the minutes `description` value is copied to the meeting `closing_report`, the `video_url` and `audio_url` minutes attributes values are copied to the respective meeting attributes and the minutes `visible` attribute value is copied to the meeting `closing_visible` attribute.
* If there was minutes data and the meeting was closed, the meeting remains closed and the meeting `closing_report` value remains if present. Elsewere the minutes `description` value is copied to the meeting `closing_report`. the `video_url` and `audio_url` minutes attributes values are copied to the respective meeting attributes and the minutes `visible` attribute value is copied to the meeting `closing_visible` attribute. In this case the visibility of closing report may change to false if there was a minutes with `visible` set to false.

Please, note that if there was previously minutes_description and closing_report data for a meeting, after applying the changes of this release, the minutes_description data will be lost.
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 format the variables in this paragraph?

…ions

* develop:
  Fix broken test on meetings after merging PR without rebase (#8076)
  Show participants list in meetings (#7933)
  Security feature external link warning (#7397)
@entantoencuanto
Copy link
Copy Markdown
Contributor Author

I think it's ready, @leio10

@leio10 leio10 merged commit 9725ec5 into develop May 28, 2021
@leio10 leio10 deleted the 7285-meetings-merge-minutes-and-close-actions branch May 28, 2021 18:39
entantoencuanto added a commit that referenced this pull request May 31, 2021
* develop: (59 commits)
  Update supported versions in docs (#8079)
  Meetings merge minutes and close actions (#7968)
  Meeting calendars providers (#7944)
  Fix broken test on meetings after merging PR without rebase (#8076)
  Show participants list in meetings (#7933)
  Security feature external link warning (#7397)
  Add missing tests for scope types admin page (#8053)
  Use symbols for polymorphic route arguments (#8052)
  Mockup design for Participation statistics tables in Votings (#7879)
  Fix boolean fields for .reported? and .hidden? which is nil if no report exists (#7990)
  Fix redirects broken by Terms and Conditions redirect (#8036)
  Amend CSS overwritting (#8007)
  New Crowdin updates (#8048)
  Fix undetected broken tests because of missing dependencies (#8050)
  Validate results by Monitoring Committee Members (#7899)
  Electoral certificate validation by Monitoring Committee Members (#7871)
  Publish and unpublish a meeting (#7893)
  New Crowdin updates (#8005)
  Polling station closure attach the physical electoral closure certificate (#7929)
  Fix attachment title migration generating possibly invalid values (#8020)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in-review module: meetings type: change PRs that implement a change for an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge actions of "Minutes" and "Close" in meetings

2 participants