Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write ID Mapper-Script | PuzzleTime Sync #2 #735

Open
4 tasks done
RandomTannenbaum opened this issue Jun 18, 2024 · 2 comments · May be fixed by #737
Open
4 tasks done

Write ID Mapper-Script | PuzzleTime Sync #2 #735

RandomTannenbaum opened this issue Jun 18, 2024 · 2 comments · May be fixed by #737
Assignees

Comments

@RandomTannenbaum
Copy link
Collaborator

RandomTannenbaum commented Jun 18, 2024

Introduction
At the moment we have the problem that we have no way of knowing which record from the PuzzleSkills DB belongs to which record from the PuzzleTime DB. We can't do this by name or similar because we can't ensure these are atomic and consistent with our data. To solve this problem we have to map the values initially, so we later know if a record is new or already exists.

To know this we essentially want a foreign key on every person record in PuzzleSkills that references the primary keys from person records in PuzzleTime. So the first step is to create a db migration to add this new field.

For the initial mapping an idea was to write a mapper script that tries to find as many matching records as possible by using an attribute like the name. The matches that are unambiguous can then be mapped automatically. Ambiguous matches or unmatched entries should be sorted out by the script for manual mapping and confirmation.

ToDo

  • Add a field to the PuzzleSkills db with a name like puzzletime_id
  • Write a mapper script that maps the IDs from PuzzleTime to the puzzletime_id fields in PuzzleSkills by an Attribute like name.
  • Manually map or find another Method for the IDs that cannot be mapped automatically.
  • Tests
@RandomTannenbaum
Copy link
Collaborator Author

RandomTannenbaum commented Jun 21, 2024

Stand 21.06.2024
Ich habe die Migration erstellt. Ausserdem habe ich angefangen das Mapper Skript zu schreiben. Dieses kann jetzt sowohl Daten aus dem Puzzle Skills als auch aus dem Puzzle Time per http Request abfragen.

Postman kann übrigens aus den gesendeten Requests direkt den zugehörigen Ruby Code generieren 😉

@ManuelMoeri ManuelMoeri linked a pull request Jun 24, 2024 that will close this issue
@ManuelMoeri ManuelMoeri self-assigned this Jun 24, 2024
@RandomTannenbaum
Copy link
Collaborator Author

RandomTannenbaum commented Jun 27, 2024

Stand 27.06.2024
Das ist script ist nun fertig und auch tests dazu mit Hilfe von webmock sind geschrieben. Ausserdem haben wir einen PTime-API client geschrieben, mit dem man die get abfragen an die PuzzleTime API ausführen kann.

Das script ist über die Rake Task rake ptime:assign ausführbar. Diese task führt das Mapping direkt durch. Es gibt aber noch die zweite Rake Task: rake ptime:evaluate_assign. Diese macht das Selbe wie die erste Task, nur werden die IDs noch nicht assigned. Dadurch kann man einen dry-run ausführen, um vorher schon zu überprüfen, welche Personen aus dem Times gemapt werden können.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants