(self, previous, current)
| 10597 | ]) |
| 10598 | |
| 10599 | def _social_snapshot_diff(self, previous, current): |
| 10600 | p_recs = {self._social_snapshot_record_identity(r): r for r in previous.get("records", []) if self._social_snapshot_record_identity(r)} |
| 10601 | c_recs = {self._social_snapshot_record_identity(r): r for r in current.get("records", []) if self._social_snapshot_record_identity(r)} |
| 10602 | p_ids = set(p_recs.keys()) |
| 10603 | c_ids = set(c_recs.keys()) |
| 10604 | added = [c_recs[i] for i in sorted(c_ids - p_ids)] |
| 10605 | removed = [p_recs[i] for i in sorted(p_ids - c_ids)] |
| 10606 | changed = [] |
| 10607 | for i in sorted(p_ids & c_ids): |
| 10608 | pb = p_recs[i] |
| 10609 | cb = c_recs[i] |
| 10610 | if cb.get("info") != pb.get("info"): |
| 10611 | changed.append({"identity": i, "before": pb, "after": cb}) |
| 10612 | return { |
| 10613 | "added": added, |
| 10614 | "removed": removed, |
| 10615 | "changed": changed, |
| 10616 | "added_count": len(added), |
| 10617 | "removed_count": len(removed), |
| 10618 | "changed_count": len(changed), |
| 10619 | } |
| 10620 | |
| 10621 | def _read_social_snapshot_history(self, target, platform, limit=10): |
| 10622 | path = self._social_snapshot_file(target, platform) |
no test coverage detected