-
Notifications
You must be signed in to change notification settings - Fork 9
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
Old databases migrations #1038
base: master
Are you sure you want to change the base?
Old databases migrations #1038
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1038 +/- ##
=========================================
- Coverage 70.13% 67% -3.14%
=========================================
Files 107 112 +5
Lines 5126 5388 +262
Branches 672 707 +35
=========================================
+ Hits 3595 3610 +15
- Misses 1417 1664 +247
Partials 114 114
Continue to review full report at Codecov.
|
Preco su tam 2 fks migracne skripty? aky je medzi nimi rozdiel? Predpokladam ze kedze to pouzijeme asi len raz, tak sa nam k tomu asi nechce pisat testy, ale v tom pripade si chceme byt isty ze to robi co ma a pouzit to skor ako to bude out of date. btw treba to zrejme rebasnut. |
Su tam 3 FKS skripty. Jeden je na staru databazu, a dva su na dva rvozne druhy CSV ciek z akcie 30 rokov fks. Rad k tomu napisem nejake testy, len si niesom uplne isty ako. Mockovat vsetky tie databazy a subory by som nerad. Mozem ale napisat checker na niekolko userov a to, ako sa mali pomigrovat. |
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.
Sorry ze to tolko trvalo, ale tu mas.
Zatial som pozerak ksp a base.
Skus aplikovat pripomienky aj na ostatne veci, potom to pozriem cele.
BIRTHDAY_PROP = 2 | ||
|
||
|
||
class Command(MigrateBaceCommand): |
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.
Base
for row in c: | ||
self.process_school(*row) | ||
|
||
# TODO sustredka |
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.
Mozno by bolo dobre tuna linknut issue na githube, aby to nebol len nahodny comment v kode, na ktory sa zabudne.
class Command(MigrateBaceCommand): | ||
help = 'Imports people and their related info from kaspar.' | ||
|
||
def handle_noargs(self, **options): |
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.
Tato metoda toho robi uz prilis vela, treba to rozdelit do mensich metod.
- ziskanie zoznamu sustrediek
- ziskanie zoznamu ucastnikov
- ziskanie poctu sustredeni
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.
ok
sys.setdefaultencoding("utf-8") | ||
|
||
|
||
class MigrateBaceCommand(NoArgsCommand): |
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.
Base
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.
done
dest='dry', | ||
default=True, | ||
help='Actually write something to DB') | ||
parser.add_argument('--fast', |
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.
Toto chce lepsi description - co je to "few users"?
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.
done
if self.dry: | ||
new_user = User(**user_args) | ||
else: | ||
addr = None |
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.
naco je tu tato premenna - ak dobre vidim, addr sa pouzije len na riadku 197 a medzitym je aj tak prepisana.
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.
ok
address['town'], | ||
address['postal_code'], | ||
address['country']) | ||
user_args['home_address'] = addr |
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.
tu mozes rovno priradit to co priradujes do addr a addr vyhodit
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.
ok
if valid_contacts: | ||
user_properties.append([self.LAST_CONTACT_PROPERTY, max(valid_contacts)]) | ||
|
||
user_properties = list(filter(lambda x: x, user_properties)) |
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.
Toto je velmi obskurne. Co napriklad:
user_properties = [prop for prop in user_properties if prop is not None]
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.
ok
|
||
similar_users = get_similar_users(new_user) | ||
if len(similar_users): | ||
names_of_similar = [(x.first_name, x.last_name) for x in similar_users] |
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.
Nie som uplne fanusik pouzivania premennej x na vsetko ale whatever.
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.
ok
self.similar_users.append(((first_name, last_name), names_of_similar)) | ||
if self.verbosity >= 2: | ||
self.stdout.write('Similar users: %s' % str(names_of_similar)) | ||
if self.dry: |
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.
co napr. if not self.dry:
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.
ok
Pokial mi je zname, od mojho podledneho review sa nic neudialo (Vlejd tusim pise diplomovku alebo co) |
Momentalny stav je, ze si vybavujem povolenie v googli, aby som mohol nico urobit. Ono google ma narok na vsetok kod ktory napises ked si tam zamestnany a mohli by z toho byt problemy. |
Ja som to nejak neriešil.
…On Mon, Aug 21, 2017, 18:46 vlejd ***@***.***> wrote:
Momentalny stav je, ze si vybavujem povolenie v googli, aby som mohol nico
urobit. Ono google ma narok na vsetok kod ktory napises ked si tam
zamestnany a mohli by z toho byt problemy.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1038 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABH4N629Wqp98Ds32cUkm8knGimY992cks5sacKQgaJpZM4Mwepd>
.
|
@@ -120,7 +121,8 @@ def create_school(self, abbr, name, addr_name, street, | |||
abbr += '?' # Question mark denotes schools needing review. | |||
school = None | |||
if len(zip_code) > 10: | |||
# Swiss zip codes | |||
# Swiss zip codes are longer than 10 chars, but our db model does not allow |
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.
Nechceme zmenit model aby ich podporoval?
Ak sa nam nechce teraz, mozes sem pridat TODO
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.
Ake dlhe su svajciarske PSC? Podla wikipedia a google map 4 miesta.
V python 3 nefunguje, skonci s chybou |
Po lokálnom spustení s python2
|
Uz by to malo bezat pod py3. |
Migration scripts for kms, fks, ksp and some csv files.
We do not migrate old competitions nor old camps.