Fix Editor sorting with >1 editor

Follow-up to eec0f00784
This commit is contained in:
Dan Stillman 2020-02-26 14:45:48 -05:00
parent 37bae44d03
commit 8170cf09de

View file

@ -1420,6 +1420,30 @@ Zotero.Items = function() {
+ "SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators "
+ `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID}`
+ ") "
+ "WHEN 2 THEN ("
+ "SELECT "
+ "(SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators "
+ `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID} `
+ "ORDER BY orderIndex LIMIT 1)"
+ " || ' ' || "
+ "(SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators "
+ `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID} `
+ "ORDER BY orderIndex LIMIT 1,1) "
+ ") "
+ "ELSE ("
+ "SELECT "
+ "(SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators "
+ `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID} `
+ "ORDER BY orderIndex LIMIT 1)"
+ " || ' ' || "
+ "(SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators "
+ `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID} `
+ "ORDER BY orderIndex LIMIT 1,1)"
+ " || ' ' || "
+ "(SELECT " + nameSQL + " FROM itemCreators NATURAL JOIN creators "
+ `WHERE itemID=O.itemID AND creatorTypeID=${editorCreatorTypeID} `
+ "ORDER BY orderIndex LIMIT 2,1)"
+ ") "
+ "END, "
// Then try contributors