Skip to content

Commit

Permalink
fix function normalize_wbeditentity_data(data, entity, options, callb…
Browse files Browse the repository at this point in the history
…ack) #2
  • Loading branch information
kanasimi committed Dec 7, 2024
1 parent b780138 commit 377bee6
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions application/net/wiki/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5098,6 +5098,8 @@ function module_code(library_namespace) {

var property_id = claim.property;
var value = wikidata_datavalue(claim);
var new_claim_has_additional = claim.qualifiers
|| claim.references;

var property_data = {
type : 'statement',
Expand All @@ -5118,14 +5120,26 @@ function module_code(library_namespace) {
}

if (duplicate_index !== NOT_FOUND) {
if (claim.qualifiers || claim.references) {
library_namespace.info(
var exists_claim
//
= exists_property_list[duplicate_index];
var exists_claim_has_additional
//
= exists_claim.qualifiers || exists_claim.references;
if (!new_claim_has_additional
|| exists_claim_has_additional) {
library_namespace.log(
//
'normalize_wbeditentity_data: '
//
+ '[[' + entity.id + ']] 已存在 ' + property_id + '='
+ value);
if (claim.qualifiers || claim.references) {
+ '[[' + entity.id + ']] 已存在 '
//
+ property_id + '=' + value

+ (exists_claim_has_additional
//
? ' 且有額外屬性 .qualifiers 或 .references' : ''));
if (new_claim_has_additional) {
library_namespace.warn(
// 警告: 這邊 wbeditentity_only: true 的行為與
// wbeditentity_only: false
Expand All @@ -5148,8 +5162,6 @@ function module_code(library_namespace) {
} else if (value_to_set[property_id].has(value)) {
var claim_to_set = value_to_set[property_id].get(value);
// assert: !!claim_to_set === true
var new_claim_has_additional = claim.qualifiers
|| claim.references;
if (!new_claim_has_additional || claim_to_set.qualifiers
|| claim_to_set.references) {
if (new_claim_has_additional) {
Expand Down

0 comments on commit 377bee6

Please sign in to comment.