יחידה:PropertyLink: הבדלים בין גרסאות בדף

אין תקציר עריכה
מיון לפי מבחין "מספר סודר"
שורה 292: שורה 292:
options['source'] = options['source'] or false
options['source'] = options['source'] or false
options['filter'] = options['filter'] or nil
options['filter'] = options['filter'] or nil
options['sort'] = options['sort'] or false
     local propertyVals = mw.wikibase.getBestStatements(entityId, propertyName)
     local propertyVals = mw.wikibase.getBestStatements(entityId, propertyName)
שורה 298: שורה 299:
     local missingTranslation = 0
     local missingTranslation = 0
     local hasFallbackTransation = false
     local hasFallbackTransation = false
    local sortBySeriesOrdinal = function(t1, t2)
    if t1 and t2 then
    local q1 = t1.qualifiers
    local q2 = t2.qualifiers
    local c1 = nil
    local c2 = nil
    if q1 and q2 then
    if q1['P1545'] and q1['P1545'][1] and q1['P1545'][1].datavalue then
    c1 = q1['P1545'][1].datavalue.value
    end
    if q2['P1545'] and q2['P1545'][1] and q2['P1545'][1].datavalue then
    c2 = q2['P1545'][1].datavalue.value
    end
    if c1 and c2 then
    return c1<c2
    elseif c1 then
    return true
    elseif c2 then
    return false
    end
    elseif q1 then
return true
    elseif q2 then
return false
end
else
if t1 then
return true
end
if t2 then
return false
end
    end
return false
    end
    if options['sort'] then
    table.sort(propertyVals, sortBySeriesOrdinal)
    end


if options['filter'] then
if options['filter'] then