Skip to content

Commit

Permalink
🐛 InputFields merged to wrong publication
Browse files Browse the repository at this point in the history
Since the last version of JW Library, a location
can have an empty MepsLanguage. Probably
this has been implemented so that personal
notes in a publication will be shown regardless
of its language (i.e. a ticked box is ticked
both in english as well as in any other language
of the same publication).
The model for Location, however, wasn't
updated accordingly when adding support
for it in #141.
This meant that newly created entries
in input fields might be skipped because
of a `NullableMismatch`, in the end resulting
in inputField entries showing up at wrong
locations or being missing completely.

This PR fixes that issue now.
  • Loading branch information
AndreasSko committed Sep 1, 2023
1 parent 73132d8 commit 42be6b9
Show file tree
Hide file tree
Showing 14 changed files with 358 additions and 261 deletions.
96 changes: 48 additions & 48 deletions cmd/merge_test.go

Large diffs are not rendered by default.

74 changes: 37 additions & 37 deletions gomobile/Merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ var leftMultiCollision = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 1", true},
},
Expand Down Expand Up @@ -328,7 +328,7 @@ var rightMultiCollision = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 1", true},
},
Expand Down Expand Up @@ -547,14 +547,14 @@ var leftDB = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 1", true},
},
{
LocationID: 2,
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 1,
},
nil,
Expand All @@ -563,7 +563,7 @@ var leftDB = &model.Database{
LocationID: 5,
DocumentID: sql.NullInt32{1102021811, true},
KeySymbol: sql.NullString{"lffi", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
},
},
Expand Down Expand Up @@ -710,30 +710,30 @@ var rightDB = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{2, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 2", true},
},
{
LocationID: 2,
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 1,
},
{
LocationID: 3,
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 1", true},
},
{
LocationID: 4,
DocumentID: sql.NullInt32{1102021811, true},
KeySymbol: sql.NullString{"lffi", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
},
},
Expand Down Expand Up @@ -890,30 +890,30 @@ var mergedAllLeftDB = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 1", true},
},
{
LocationID: 2,
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 1,
},
{
LocationID: 3,
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{2, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 2", true},
},
{
LocationID: 4,
DocumentID: sql.NullInt32{1102021811, true},
KeySymbol: sql.NullString{"lffi", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
},
},
Expand Down Expand Up @@ -1099,30 +1099,30 @@ var mergedAllRightDB = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 1", true},
},
{
LocationID: 2,
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 1,
},
{
LocationID: 3,
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{2, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 2", true},
},
{
LocationID: 4,
DocumentID: sql.NullInt32{1102021811, true},
KeySymbol: sql.NullString{"lffi", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
},
},
Expand Down Expand Up @@ -1261,14 +1261,14 @@ var leftNwtDB = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwt", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 1", true},
},
{
LocationID: 2,
KeySymbol: sql.NullString{"nwt", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 1,
},
nil,
Expand All @@ -1277,7 +1277,7 @@ var leftNwtDB = &model.Database{
LocationID: 5,
DocumentID: sql.NullInt32{1102021811, true},
KeySymbol: sql.NullString{"lffi", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
},
},
Expand Down Expand Up @@ -1330,30 +1330,30 @@ var rightNwtDB = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{2, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 2", true},
},
{
LocationID: 2,
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 1,
},
{
LocationID: 3,
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 1", true},
},
{
LocationID: 4,
DocumentID: sql.NullInt32{1102021811, true},
KeySymbol: sql.NullString{"lffi", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
},
},
Expand Down Expand Up @@ -1415,29 +1415,29 @@ var mergedAllLeftNwtDB = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 1", true},
},
{
LocationID: 2,
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 1,
},
{
LocationID: 3,
DocumentID: sql.NullInt32{1102021811, true},
KeySymbol: sql.NullString{"lffi", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
},
{
LocationID: 4,
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{2, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
LocationType: 0,
Title: sql.NullString{"1. Mose 2", true},
},
Expand Down Expand Up @@ -1510,13 +1510,13 @@ var leftDBNwtWithDifferentDocID = &model.Database{
LocationID: 1,
DocumentID: sql.NullInt32{1102021811, true},
KeySymbol: sql.NullString{"lffi", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
},
{
LocationID: 2,
DocumentID: sql.NullInt32{123456789, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
},
// Make sure that when migrating to nwtsty we don't have duplicate locations
// in case the nwtsty-location already exists on the other side
Expand All @@ -1525,7 +1525,7 @@ var leftDBNwtWithDifferentDocID = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
},
},
Note: []*model.Note{nil},
Expand Down Expand Up @@ -1589,7 +1589,7 @@ var rightDBNwtWithDifferentDocID = &model.Database{
LocationID: 1,
DocumentID: sql.NullInt32{987654332, true},
KeySymbol: sql.NullString{"nwt", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
},
// Make sure that when migrating to nwtsty we don't have duplicate locations
// in case the nwtsty-location already exists on the other side
Expand All @@ -1598,7 +1598,7 @@ var rightDBNwtWithDifferentDocID = &model.Database{
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwt", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
},
},
Note: []*model.Note{nil},
Expand Down Expand Up @@ -1669,26 +1669,26 @@ var mergedDBNwtWithDifferentDocID = &model.Database{
LocationID: 1,
DocumentID: sql.NullInt32{1102021811, true},
KeySymbol: sql.NullString{"lffi", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
},
{
LocationID: 2,
DocumentID: sql.NullInt32{123456789, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
},
{
LocationID: 3,
DocumentID: sql.NullInt32{987654332, true},
KeySymbol: sql.NullString{"nwt", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
},
{
LocationID: 4,
BookNumber: sql.NullInt32{1, true},
ChapterNumber: sql.NullInt32{1, true},
KeySymbol: sql.NullString{"nwtsty", true},
MepsLanguage: 2,
MepsLanguage: sql.NullInt32{Int32: 2, Valid: true},
},
},
Note: []*model.Note{nil},
Expand Down
Loading

0 comments on commit 42be6b9

Please sign in to comment.