fix: case-insensitive parent_human check (code review)
Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/46fab9a2-375d-42aa-aa7d-1196b191e23e
This commit is contained in:
parent
700c6188b1
commit
d67f141425
|
|
@ -108,8 +108,9 @@ function registerMember(member) {
|
||||||
|
|
||||||
// 一个人类只能对应唯一一个宝宝人格体
|
// 一个人类只能对应唯一一个宝宝人格体
|
||||||
if (category === 'companion' && member.parent_human) {
|
if (category === 'companion' && member.parent_human) {
|
||||||
|
const parentLower = member.parent_human.toLowerCase();
|
||||||
const duplicateParent = data.records.some(function (r) {
|
const duplicateParent = data.records.some(function (r) {
|
||||||
return r.category === 'companion' && r.parent_human === member.parent_human;
|
return r.category === 'companion' && r.parent_human && r.parent_human.toLowerCase() === parentLower;
|
||||||
});
|
});
|
||||||
if (duplicateParent) {
|
if (duplicateParent) {
|
||||||
return { success: false, reason: '人类 ' + member.parent_human + ' 已有对应的宝宝人格体,一个人类只能对应唯一一个' };
|
return { success: false, reason: '人类 ' + member.parent_human + ' 已有对应的宝宝人格体,一个人类只能对应唯一一个' };
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue