Skip to content

Meeting agenda implementation#3305

Merged
oriolgual merged 5 commits intomasterfrom
3233_meeting_agenda
Jun 5, 2018
Merged

Meeting agenda implementation#3305
oriolgual merged 5 commits intomasterfrom
3233_meeting_agenda

Conversation

@isaacmg410
Copy link
Copy Markdown
Contributor

@isaacmg410 isaacmg410 commented Apr 27, 2018

🎩 What? Why?

This PR is to add meeting agenda CRUD

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Add models (agenda, agenda_item)
  • Add commands
  • Add controllers
  • Add views
  • Create Specs

📷 Screenshots (optional)

Description

@ghost ghost assigned isaacmg410 Apr 27, 2018
@ghost ghost added the status: WIP label Apr 27, 2018
@isaacmg410
Copy link
Copy Markdown
Contributor Author

Hey @decidim/lot-core, can you take a global review and give your opinion, please?
I know that specs are missing, but I would appreciate a pre-review before create the tests.

visible: @form.visible,
meeting: @meeting
)
create_agenda_items
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.

Not super important, but I'd move this to call for better readability


def update_nested_model(form, attributes, agenda_item_childs)
record = agenda_item_childs.find_by(id: form.id) || agenda_item_childs.build(attributes)
# record = Decidim::Meetings::AgendaItem.find_or_create_by!(attributes)
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.

Delete this?

# Broadcasts :ok if successful, :invalid otherwise.
def call
return broadcast(:invalid) if form.invalid?
# return broadcast(:invalid) if @meeting.meeting_duration < form.agenda_items.sum(&:duration)
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.

?

class UpdateAgenda < Rectify::Command
def initialize(form, meeting, agenda)
@form = form
@meeting = 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.

@meeting is never used

agenda_items.each do |agenda_item|
duration_childs += agenda_item.agenda_item_childs.sum(&:duration)
end
duration + duration_childs
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.

Maybe you don't need to initalize the values?

What about this?

(agenda_items.map(&:duration) + agenda_items.map(&:agenda_item_childs).map(&:duration).sum

end

def agenda_item_childs_duration_lower_than_or_equal_than_parent
# return true unless self.agenda_item_childs.presence
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.

?

end

def set_agenda_items_start_end_times(agenda_items, meeting, start_time_parent = nil)
array = []
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.

Could you please use a more meaningful variable name? 😅


module Decidim
module Meetings
# The data store for a Meeting in the Decidim::Meetings component. It stores a
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.

Wrong docs.


module Decidim
module Meetings
# The data store for a Meeting in the Decidim::Meetings component. It stores a
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.

Wrong docs.

end

def meeting_duration
((end_time - start_time) * 24 * 60).to_i
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.

@meeting_duration ||= maybe?

@ghost ghost assigned rbngzlv May 27, 2018
@rbngzlv rbngzlv force-pushed the 3233_meeting_agenda branch from f1e89a8 to 5346abf Compare May 27, 2018 21:53
@isaacmg410 isaacmg410 changed the title [WIP] Meeting agenda implementation Meeting agenda implementation May 28, 2018
@xabier xabier mentioned this pull request May 28, 2018
74 tasks
@rbngzlv rbngzlv force-pushed the 3233_meeting_agenda branch from 5346abf to 4920ba5 Compare June 1, 2018 15:47
@ghost ghost added the status: WIP label Jun 1, 2018
@rbngzlv rbngzlv force-pushed the 3233_meeting_agenda branch 2 times, most recently from 9f13d09 to f93c253 Compare June 1, 2018 16:49
@rbngzlv
Copy link
Copy Markdown
Contributor

rbngzlv commented Jun 4, 2018

@decidim/lot-core ready to review.

});

const createDynamicFieldsForAgendaItemChilds = (fieldId) => {
// const autoButtons = createAutoButtonsByMinItemsForAnswerOptions(fieldId);
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.

Should we remove this?


hideDeletedAgendaItem($target);
setupInitialAgendaItemChildAttributes($target);
// createDynamicFieldsForAgendaItemChilds($target)
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.

Ditto

end

def agenda_duration
agenda_items.sum(&:duration)
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.

Memoize this?
@agenda_item ||= agenda_items.sum(&:duration)

@meeting ||= context[:meeting]
end

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

Maybe agenda_duration_too_long?

agenda_items.sum(&:duration)
end

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

agenda_items_duration_too_long ?

end
end

# Public: This method is used to calc the start and end time
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.

s/calc/calculate

@ghost ghost added the status: WIP label Jun 5, 2018
@rbngzlv
Copy link
Copy Markdown
Contributor

rbngzlv commented Jun 5, 2018

@oriolgual, recommendations applied.

@oriolgual oriolgual merged commit 8b84052 into master Jun 5, 2018
@oriolgual oriolgual deleted the 3233_meeting_agenda branch June 5, 2018 14:58
josepjaume pushed a commit that referenced this pull request Jun 6, 2018
* Add meeting agenda and agenda items (@isaacmg410)

* Add change log entry (@isaacmg410)

* Add specs

* Enforce permissions in controller

* Remove commented code and improve functions names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants