Skip to content

Commit

Permalink
AB#1064 bugfix for adding event to report
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco del Castillo committed Oct 8, 2024
1 parent 04f4cac commit 948880d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/src/models/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ export default class Event extends Model {
super(Model.fillObject(props, Event.yupSchema))
}

static FILTERED_CLIENT_SIDE_FIELDS = []
static FILTERED_CLIENT_SIDE_FIELDS = ["tasks", "organizations", "people"]

static filterClientSideFields(obj, ...additionalFields) {
return Model.filterClientSideFields(
Expand Down
1 change: 1 addition & 0 deletions client/src/pages/reports/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ const ReportForm = ({
name="event"
component={FieldHelper.SpecialField}
onChange={value => {
value = Event.filterClientSideFields(value)
// validation will be done by setFieldValue
setFieldTouched("event", true, false) // onBlur doesn't work when selecting an option
setFieldValue("event", value, true)
Expand Down
4 changes: 1 addition & 3 deletions client/src/pages/reports/New.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ const ReportNewConditional = ({
const event = new Event(data.event)
const tasks = []
event.tasks.forEach(task => tasks.push(new Task(task)))
// We do not want tasks to go with event Probably there is a better way to do this?
event.tasks = []
report.event = event
report.event = Event.filterClientSideFields(event)
report.location = event.location
report.tasks = tasks
}
Expand Down

0 comments on commit 948880d

Please sign in to comment.