Fix NocoDB PATCH using wrong record identifier, causing overwrites

update_record was using the custom field ID to identify rows in PATCH
requests instead of NocoDB's internal Id primary key. This prevented
proper row matching, causing values to be overwritten instead of
appended to the comma-separated seeder list.
This commit is contained in:
constantprojects
2026-02-17 14:54:52 -07:00
parent b260aa3bde
commit 4d6e664ba6

View File

@@ -263,10 +263,10 @@ class NocoDBClient:
print(f" DEBUG: get_record error: {e}", file=sys.stderr) print(f" DEBUG: get_record error: {e}", file=sys.stderr)
return None return None
def update_record(self, record_id: int | str, value: str) -> bool: def update_record(self, row_id: int, value: str) -> bool:
"""Update the seeding_users field on a record.""" """Update the seeding_users field on a record."""
try: try:
data = {self.id_field: int(record_id), self.seeding_field: value} data = {"Id": row_id, self.seeding_field: value}
self._request("PATCH", data=data) self._request("PATCH", data=data)
return True return True
except Exception as e: except Exception as e:
@@ -457,7 +457,7 @@ To find field IDs in NocoDB: click field header dropdown → Copy Field ID (star
current_seeders.add(username) current_seeders.add(username)
new_value = format_multiselect(current_seeders) new_value = format_multiselect(current_seeders)
if noco.update_record(torrent_id, new_value): if noco.update_record(record["Id"], new_value):
print(f" + {torrent_id}: added {username}") print(f" + {torrent_id}: added {username}")
api_stats['updated'] += 1 api_stats['updated'] += 1
else: else: