Repository navigation
refactor(entities.record): Don't include if an older version file is restricted - #652
Conversation
| def has_any_restricted_file(self): | ||
| """True if any of the legacy files carries a restriction status.""" | ||
| return any(file.get("status") for file in self.dojson_entry.get("files", [])) | ||
| return any(file.get("status") for file in self.raw_dump_entry.get("files", [])) |
There was a problem hiding this comment.
could you explain why switching this makes the difference? dojson entry normally should not manipulate the files key, only the marc
There was a problem hiding this comment.
Because dojson_entry only has data from the latest version, and now we're checking for restricted files across all versions
There was a problem hiding this comment.
this is latest revision of the legacy record (history of changes on metadata of the records), not the RDM versions information. The files should be the same in both cases. Can you recheck?
There was a problem hiding this comment.
Yeah, so on further checking I found out that dojson_entry doesn't carry files key.
When I updated the test to be exactly like the new flow of the code, it got caught, so using without raw_dump_entry without the get operator is the correct fix. Otherwise it was falling back to an empty list of files.
0fe2fde to
9764cd4
Compare
fixes: #542