thomas-institut / apm

Digital Edition web application for the Averroes Project
GNU General Public License v3.0
2 stars 0 forks source link

EditorData returns elements in the wrong order #62

Open rafaelnajera opened 6 years ago

rafaelnajera commented 6 years ago

For example, this quillData:

s {ops: Array(54)}
ops
:
Array(54)
0
:
{attributes: {…}, insert: "Some text, and more text"}
1
:
{insert: "↵"}
2
:
{attributes: {…}, insert: "another line including a "}
3
:
{attributes: {…}, insert: "rubric"}
4
:
{attributes: {…}, insert: " and more."}
5
:
{insert: "↵"}
6
:
{attributes: {…}, insert: "More text, "}
7
:
{attributes: {…}, insert: "some be substituted"}
8
:
{insert: "↵"}
9
:
{attributes: {…}, insert: "Marginal additions can have all sorts of textual items"}
10
:
{attributes: {…}, insert: "↵"}
11
:
{attributes: {…}, insert: "inside them. For instance: "}
12
:
{attributes: {…}, insert: "rubrics"}
13
:
{attributes: {…}, insert: ", "}
14
:
{attributes: {…}, insert: "sis"}
15
:
{attributes: {…}, insert: ", "}
16
:
{attributes: {…}, insert: "abbr"}
17
:
{attributes: {…}, insert: ". and "}
18
:
{attributes: {…}, insert: "ded text"}
19
:
{attributes: {…}, insert: "."}
20
:
{attributes: {…}, insert: "↵"}
21
:
{attributes: {…}, insert: "They can even have "}
22
:
{attributes: {…}, insert: "additions,"}
23
:
{attributes: {…}, insert: " and, of course, editorial notes."}
24
:
{insert: {…}}
25
:
{attributes: {…}, insert: "↵"}
26
:
{attributes: {…}, insert: "Anything goes!"}
27
:
{attributes: {…}, insert: "↵"}
28
:
{attributes: {…}, insert: "Another marginal, in this case a gloss presumably at "}
29
:
{attributes: {…}, insert: "↵"}
30
:
{attributes: {…}, insert: "a different place than the previous additions. The convention"}
31
:
{attributes: {…}, insert: "↵"}
32
:
{attributes: {…}, insert: "should be that "}
33
:
{attributes: {…}, insert: "additions"}
34
:
{attributes: {…}, insert: " are read into the main text in the"}
35
:
{attributes: {…}, insert: "↵"}
36
:
{attributes: {…}, insert: "order in "}
37
:
{attributes: {…}, insert: "which"}
38
:
{attributes: {…}, insert: " they are "}
39
:
{attributes: {…}, insert: "given"}
40
:
{attributes: {…}, insert: ", "}
41
:
{attributes: {…}, insert: "unless"}
42
:
{attributes: {…}, insert: " they point to specific"}
43
:
{attributes: {…}, insert: "↵"}
44
:
{attributes: {…}, insert: "items (marks or deletions) in the main text. Gloss…xt, but may be indicated in the collation tables."}
45
:
{attributes: {…}, insert: "↵"}
46
:
{attributes: {…}, insert: "A some more and some more. This is actually a substitution!"}
47
:
{attributes: {…}, insert: "↵"}
48
:
{attributes: {…}, insert: "With two lines."}
49
:
{attributes: {…}, insert: "↵"}
50
:
{attributes: {…}, insert: "Some more text after the additions."}
51
:
{insert: "↵"}
52
:
{attributes: {…}, insert: "Custos"}
53
:
{attributes: {…}, insert: "↵"}

Generates

elements
:
Array(6)
0
:
{id: 1, pageId: 2150, columnNumber: 1, lang: "la", editorId: 47399, …}
1
:
columnNumber
:
1
editorId
:
47399
handId
:
0
id
:
"-1002"
items
:
(18) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
lang
:
"la"
pageId
:
2150
placement
:
"margin left"
reference
:
"16957"
seq
:
1
type
:
7
__proto__
:
Object
2
:
columnNumber
:
1
editorId
:
47399
handId
:
0
id
:
"11504"
items
:
(17) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
lang
:
"la"
pageId
:
2150
placement
:
"margin left"
reference
:
null
seq
:
2
type
:
3
__proto__
:
Object
3
:
columnNumber
:
1
editorId
:
47399
handId
:
0
id
:
"11522"
items
:
(3) [{…}, {…}, {…}]
lang
:
"la"
pageId
:
2150
placement
:
"margin left"
reference
:
"16967"
seq
:
3
type
:
7
__proto__
:
Object
4
:
{id: 2, pageId: 2150, columnNumber: 1, lang: "la", editorId: 47399, …}
5
:
{id: 3, pageId: 2150, columnNumber: 1, lang: "la", editorId: 47399, …}
rafaelnajera commented 6 years ago

Actually, the problem is in the server. For some reason the sequence number of an element is not updated and this results in two elements with the same sequence number in the database. The order in which these two elements appear when returning list of elements for a page and column is unpredictable.

This may be caused by inconsistencies in older versions of the system. I created a checker/fixer for sequence numbers and will monitor if the database at some point becomes inconsistent again.

rafaelnajera commented 6 years ago

On Feb 8, only one sequence was wrong on a page with only 2 elements: marginal addition and main text. It may have to do with the marginal addition having a bad reference item (the mark item occurs after the reference), but I'm not sure.

View log at 2018-02-07 22:28:21, changes by Alex (id: 85530)

rafaelnajera commented 6 years ago

On Jul 31, 2018, only one sequence wrong, and including one addition, changed by Alex, 2018-07-18 (id: 85530), page id 11796