mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
gendummydata.py: Change variable to string to eliminate redundant code
There is no reason the MaintainerUID can't be treated as a string within this script. By changing to a string an "if" statement can be eliminated. Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
cf2b82239d
commit
a4ed3a3b3b
1 changed files with 5 additions and 11 deletions
|
@ -187,20 +187,14 @@ for p in list(seen_pkgs.keys()):
|
||||||
else:
|
else:
|
||||||
muid = trustedusers[random.randrange(0,len(trustedusers))]
|
muid = trustedusers[random.randrange(0,len(trustedusers))]
|
||||||
if count % 20 == 0: # every so often, there are orphans...
|
if count % 20 == 0: # every so often, there are orphans...
|
||||||
muid = 0
|
muid = "NULL"
|
||||||
|
|
||||||
uuid = genUID() # the submitter/user
|
uuid = genUID() # the submitter/user
|
||||||
|
|
||||||
if muid == 0:
|
s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
|
||||||
s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
|
" SubmittedTS, SubmitterUID, MaintainerUID) VALUES "
|
||||||
" SubmittedTS, SubmitterUID, MaintainerUID) VALUES"
|
" (%d, '%s', '%s', %d, %d, %d, %s);\n")
|
||||||
" (%d, '%s', '%s', %d, %d, %d, NULL);\n")
|
s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid, muid)
|
||||||
s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid)
|
|
||||||
else:
|
|
||||||
s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
|
|
||||||
" SubmittedTS, SubmitterUID, MaintainerUID) VALUES "
|
|
||||||
" (%d, '%s', '%s', %d, %d, %d, %d);\n")
|
|
||||||
s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid, muid)
|
|
||||||
|
|
||||||
out.write(s)
|
out.write(s)
|
||||||
count += 1
|
count += 1
|
||||||
|
|
Loading…
Add table
Reference in a new issue