15.082
Bearbeitungen
(Überarbeitung, + Sortierung Geburtshaus/ort und Letzter Wohnort) |
(smwDate2SortIndex() verbessert) |
||
| Zeile 106: | Zeile 106: | ||
function p.sortIndex(address) | function p.sortIndex(address) | ||
local von_sort_index = p.smwDate2SortIndex(address["AdresseVon"]) | local von_sort_index = p.smwDate2SortIndex(address["AdresseVon"], "von") | ||
local bis_sort_index = p.smwDate2SortIndex(address["AdresseBis"]) | local bis_sort_index = p.smwDate2SortIndex(address["AdresseBis"], "bis") | ||
-- Ggf. Index von Geburtshaus/-ort setzen | -- Ggf. Index von Geburtshaus/-ort setzen | ||
-- ganz nach vorne => höchste Prio = -99999999 | -- ganz nach vorne => höchste Prio = -99999999 | ||
| Zeile 140: | Zeile 140: | ||
end | end | ||
function p.smwDate2SortIndex(date) | function p.smwDate2SortIndex(date, vonbis) | ||
-- mw.log("smwDate2SortIndex(" .. date .. ")") | -- mw.log("smwDate2SortIndex(" .. date .. ")") | ||
-- Datum in Index wandeln | -- Datum in Index wandeln | ||
| Zeile 150: | Zeile 150: | ||
local sort_index = "" | local sort_index = "" | ||
local date=str.split2(date, " ") | local date=str.split2(date, " ") | ||
if #date == 1 then | if #date == 1 then -- nur Jahr vorhanden | ||
sort_index = tostring(date[1]) .. " | sort_index = tostring(date[1]) | ||
elseif #date == 2 then | if vonbis == "von" then | ||
sort_index = tostring(date[2]) .. string.format("%02d", com.getMonthnr(date[1])) .. " | sort_index = sort_index .. "9999" | ||
elseif #date == 3 then | else | ||
sort_index = sort_index .. "0000" | |||
end | |||
elseif #date == 2 then -- nur Monat + Jahr vorhanden | |||
sort_index = tostring(date[2]) .. string.format("%02d", com.getMonthnr(date[1])) | |||
if vonbis == "von" then | |||
sort_index = sort_index .. "99" | |||
else | |||
sort_index = sort_index .. "00" | |||
end | |||
elseif #date == 3 then -- komplettes Datum vorhanden | |||
sort_index = tostring(date[3]) .. string.format("%02d",com.getMonthnr(date[2])) .. string.format("%02d", tonumber(string.match(date[1], "%d*"))) | sort_index = tostring(date[3]) .. string.format("%02d",com.getMonthnr(date[2])) .. string.format("%02d", tonumber(string.match(date[1], "%d*"))) | ||
end | end | ||