File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,10 +143,29 @@ class SyncManager {
143143 .map ((i) => i.get <String >('issn' ))
144144 .toSet ();
145145
146+ bool isMatch = false ;
146147 // If an issn match I merge them to avoid duplicates
147148 if (localIssnSet.intersection (cloudIssnSet).isNotEmpty) {
149+ isMatch = true ;
150+ } else if (localIssnSet.isEmpty || cloudIssnSet.isEmpty) {
151+ String localPub = (potentialMatch['publisher' ] ?? '' )
152+ .toString ()
153+ .toLowerCase ()
154+ .trim ();
155+ String cloudPub =
156+ r.get <String >('publisher' , '' ).toLowerCase ().trim ();
157+
158+ if (localPub.isEmpty ||
159+ cloudPub.isEmpty ||
160+ localPub.contains (cloudPub) ||
161+ cloudPub.contains (localPub)) {
162+ isMatch = true ;
163+ }
164+ }
165+
166+ if (isMatch) {
148167 logger.info (
149- "Merging local journal ${potentialMatch ['sync_id' ]} into cloud ID $cloudSyncId via ISSN match ." );
168+ "Merging local journal ${potentialMatch ['sync_id' ]} into cloud ID $cloudSyncId ." );
150169 await db.update ('journals' , {'sync_id' : cloudSyncId},
151170 where: 'journal_id = ?' , whereArgs: [localId]);
152171
You can’t perform that action at this time.
0 commit comments