Conversation
|
Hey @decidim/lot-core, can you take a global review and give your opinion, please? |
| visible: @form.visible, | ||
| meeting: @meeting | ||
| ) | ||
| create_agenda_items |
There was a problem hiding this comment.
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) |
| # 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) |
| class UpdateAgenda < Rectify::Command | ||
| def initialize(form, meeting, agenda) | ||
| @form = form | ||
| @meeting = meeting |
| agenda_items.each do |agenda_item| | ||
| duration_childs += agenda_item.agenda_item_childs.sum(&:duration) | ||
| end | ||
| duration + duration_childs |
There was a problem hiding this comment.
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 |
| end | ||
|
|
||
| def set_agenda_items_start_end_times(agenda_items, meeting, start_time_parent = nil) | ||
| array = [] |
There was a problem hiding this comment.
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 |
|
|
||
| module Decidim | ||
| module Meetings | ||
| # The data store for a Meeting in the Decidim::Meetings component. It stores a |
| end | ||
|
|
||
| def meeting_duration | ||
| ((end_time - start_time) * 24 * 60).to_i |
There was a problem hiding this comment.
@meeting_duration ||= maybe?
f1e89a8 to
5346abf
Compare
5346abf to
4920ba5
Compare
9f13d09 to
f93c253
Compare
f93c253 to
9685caa
Compare
|
@decidim/lot-core ready to review. |
| }); | ||
|
|
||
| const createDynamicFieldsForAgendaItemChilds = (fieldId) => { | ||
| // const autoButtons = createAutoButtonsByMinItemsForAnswerOptions(fieldId); |
|
|
||
| hideDeletedAgendaItem($target); | ||
| setupInitialAgendaItemChildAttributes($target); | ||
| // createDynamicFieldsForAgendaItemChilds($target) |
| end | ||
|
|
||
| def agenda_duration | ||
| agenda_items.sum(&:duration) |
There was a problem hiding this comment.
Memoize this?
@agenda_item ||= agenda_items.sum(&:duration)
| @meeting ||= context[:meeting] | ||
| end | ||
|
|
||
| def agenda_duration_lt_meeting_duration |
There was a problem hiding this comment.
Maybe agenda_duration_too_long?
| agenda_items.sum(&:duration) | ||
| end | ||
|
|
||
| def agenda_item_duration_lt_than_parent |
There was a problem hiding this comment.
agenda_items_duration_too_long ?
| end | ||
| end | ||
|
|
||
| # Public: This method is used to calc the start and end time |
|
@oriolgual, recommendations applied. |
* 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
🎩 What? Why?
This PR is to add meeting agenda CRUD
📌 Related Issues
📋 Subtasks
CHANGELOGentry📷 Screenshots (optional)