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:
@@ -263,10 +263,10 @@ class NocoDBClient:
|
||||
print(f" DEBUG: get_record error: {e}", file=sys.stderr)
|
||||
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."""
|
||||
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)
|
||||
return True
|
||||
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)
|
||||
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}")
|
||||
api_stats['updated'] += 1
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user