Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored Dec 29, 2023
1 parent 8fe1e01 commit f5ca452
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ _%>

<%_ } _%>
<%_ if (relationshipsContainManyToOne) { _%>
getSelected(selectedVals, option) : any {
getSelected(selectedVals, option, pkField = 'id') : any {
if (selectedVals) {
return selectedVals.find(value => option.<%= primaryKey.name %> === value.<%= primaryKey.name %>) ?? option;
return selectedVals.find(value => option[pkField] === value[pkField]) ?? option;
}
return option;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ _%>
<div class="form-group">
<label v-text="t$('<%= translationKey %>')" for="<%= entityFileName %>-<%= relationshipName %>"><%= relationshipNameHumanized %></label>
<select class="form-control" id="<%= entityFileName %>-<%= relationshipFieldNamePlural %>" data-cy="<%= relationshipFieldName %>" multiple name="<%= relationshipName %>" v-if="<%=entityInstance %>.<%=relationshipFieldNamePlural %> !== undefined" v-model="<%=entityInstance %>.<%=relationshipFieldNamePlural %>"<% if (relationshipRequired) { %> required<% } %>>
<option v-bind:value="getSelected(<%=entityInstance %>.<%=relationshipFieldNamePlural %>, <%=otherEntityName %>Option)" v-for="<%=otherEntityName %>Option in <%=otherEntityNamePlural %>" :key="<%=otherEntityName %>Option.<%= relationship.otherEntity.primaryKey.name %>">{{<%=otherEntityName %>Option.<%=otherEntityField %>}}</option>
<option v-bind:value="getSelected(<%=entityInstance %>.<%=relationshipFieldNamePlural %>, <%=otherEntityName %>Option, '<%= relationship.otherEntity.primaryKey.name %>')" v-for="<%=otherEntityName %>Option in <%=otherEntityNamePlural %>" :key="<%=otherEntityName %>Option.<%= relationship.otherEntity.primaryKey.name %>">{{<%=otherEntityName %>Option.<%=otherEntityField %>}}</option>
</select>
</div>
<%_ } _%>
Expand Down

0 comments on commit f5ca452

Please sign in to comment.