-
Notifications
You must be signed in to change notification settings - Fork 19
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
Crm token migration #224
base: master
Are you sure you want to change the base?
Crm token migration #224
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @svenwey
Deine Lösung sieht eigentlich gut aus. Es ist nicht ganz idiomatischer Ruby/Rails Code, aber ansonsten eine gute Lösung.
Eine Korrektur zu den CSVs hätte ich noch:
Momentan sieht es aus, als ob du von einem einzelnen CSV ausgehst, welches alle Mappings hat. Da die IDs auf Seiten CRM aber aus verschiedenen Models kommt, müssen auch die CSVs separat sein, da es ID Dopplungen auf beiden Seiten (Highrise und/oder Odoo) geben kann.
Hier ein Beispiel Source Folder:
sources.tar.gz
Hey @Kagemaru |
Ich wäre für eine ENV variable für den source Ordner und hardcoden der CSV-Namen als |
… in cli during execution of the rake task
Ich habe das jetzt mal so umgesetzt. Momentan habe ich noch drin, dass die .csv keine header line haben, das musst du aber sagen, wie du das haben möchtest. |
Das können wir machen, wie wir wollen. |
The first line of the description is shown in the list. The complete description with 'rake -D'.
Also, this outputs what is being done, providing helpful output.
namespaces in Rake are purely for organizing the tasks, they do not open a new lexical scope. Therefore, all methods defined here are bound to Kernel (the implicit receiver). This makes them available to ALL rake-task and the application if the rake-tasks are being loaded. It is better to wrap them in a module and call them there. To avoid further shenanigans, 'module_function' allows calling them as if they were class-methods.
And since 'warn(msg)' is short for 'stderr.puts', we can simplify and streamline things.
And it does so, without intermediate data-shuffling. The `model.pluck()` is still needed to get an (indexed) array, so this cannot be lazy_loaded with some hackery in the SQL-Query. Interesting as this may be, this is as far as I would optimize it.
While every if could be rewritten to a postfix version, it reads best for such guard-clauses. The postfix if applies to the line only, so with multiline-bodies it is not a viable option.
Crm token migration suggestions
No description provided.