From 8bcdcbd7dba48b72a5fcf910ec09ca30d7726f06 Mon Sep 17 00:00:00 2001 From: Allie Bopp <aebopp@umich.edu> Date: Tue, 14 Jul 2020 18:16:56 -0400 Subject: [PATCH] bug fix updating org from one org to another --- .../views/__pycache__/accounts.cpython-36.pyc | Bin 14664 -> 14799 bytes servicePoints/views/accounts.py | 11 ++++++++--- var/servicePoints.sqlite3 | Bin 32768 -> 32768 bytes 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/servicePoints/views/__pycache__/accounts.cpython-36.pyc b/servicePoints/views/__pycache__/accounts.cpython-36.pyc index 8d68f269c8a49b7934f908bc8884916922c227eb..e717c9c740dd3fc38e388768906081600b17fd87 100644 GIT binary patch delta 674 zcmYL`J!lj`6vyYye$DRfZBB?Gx7j-rFBfx1Jh?M|Hiih=_<@F4oP}a0XS|ajb1M>= zMRCzeY(~T)g^)(<!d8lw0V_W`3$0TGv=9rih;P?`4DUa0|GYPE=C|*~$G&qgpLdQn zyel``>(18j2qT0T7$-6Mt0){o(uJNW9;-re_F`m6gOeWXU&Gxf5^naWSmIV>F6*2{ zrX*5JeN-FO<j$%dS)s-A(s}}O1P@~vHg{u)@w?`!r$tfNkCQ|z6-dQZyZmKf>b_rb z+bk3-oyBlrNnBOy?y!32+r=_g5$Zs?Ox)Ry4kq9H62PzI&&VC11d_1S0PvEv@)$r- zZS46874>@bE7aAqu@BHxi+eZWm^xe8gc)^c{1Kd1Z^s|P88usd02kCowNY|#l8%uP z`GQHxqf0s9!(XYw#DROzftW^`)VfYgB3)8^o`E2sLt_d=>KUY4nQx(s)##>GOp>e@ zp=P~i=Gur&LwGy=I4_6ca_1ki(Ck`WhLbF5;TgGB3=ze~JX(yqlHGvF4n6KkJ0)Hl zI49Eki;S^}+1)AivQ?*}C)B5jrjcP!U>^hD`ClVuu&`||+!p7>b#Y1!O&%{_!hh3m zpieXx3gD&ekvy`;jH%A#Hi)ECo6}$=c{BAwhqdH#^EZXh$^7(l3R~*?;cW^u`Eg_# ds=HY(@Pb_61Qsrq>Y$OXAi%sHGy*>u`U|R}md5}9 delta 554 zcmYL_O=uHA6vyX3*{^JNL!qT6>&BXXq)j1dg9W1?et`&r6pBSpZE+BqU=EvAFS{3m zJrysHfCmxpp2{8s&mKI8-X&f<BnRn9FM=4~Mp1_Uf9AcJc{A_#vHLEt&$zC=yPDtG zyK`iJEu1uk5IXBBt9!_%5Q-MsMi9|d@yc~2+E#E|>9O9?lo9KZh%(A7rf#w8D*IfE zjnGt1WIV-|;L8>(t8zW`IIg-k1B1&_dA&)S(>jfcYdLTta8j#L#p}SNzPBKQT{?0K zH1M(~eBKk%Mmh|ht%*CyFRuiAPkjFo<X9yAQXO!Ux2MWLfrfM6Fi)RO4^XAo<que= zgZUAf)L9teB5f}o;2M2ie1aQvcj+-UX}DA`S^SR1nza9h7ise?snC|eAvG#%b0We$ z*^>~F<gRp%@GmkVL3@?y9W&BYhH3mg$u)8;M_GRughtD3Sv|q@bgq%@A(mXt<&2^1 z$k<10hIuAvrUX-B>6e09Y7=%BmK#ZT*@A2RPX?E$zjA)|7PIVD_@u}<m_j}U2Ahso z#<-sxSGO_<lgqW28eSw{8b2i7CxeY=5<_}$b}WA)dDz?lX6V(qVy@tu{;FU1J%9E$ DyHSE^ diff --git a/servicePoints/views/accounts.py b/servicePoints/views/accounts.py index 0e38fd8..0ea090b 100644 --- a/servicePoints/views/accounts.py +++ b/servicePoints/views/accounts.py @@ -233,7 +233,8 @@ def index(): leaderCur = cursor.execute('SELECT orgName FROM orgs WHERE ' 'username =:who', {"who": username}) - if leaderCur.fetchone() is None: + tryfetch = leaderCur.fetchone() + if tryfetch is None or tryfetch["orgName"] == "NONE": leader = 0 else: leader = 1 @@ -345,10 +346,14 @@ def profile(): orgName = str(flask.request.form['orgName']) username = str(flask.session['username']) cur = servicePoints.model.get_db() + curOrg = cur.execute('SELECT orgName FROM users WHERE username = ?', + (username,)) + org = curOrg.fetchone() cur.execute('UPDATE users SET orgName = ? WHERE username = ?', (orgName, username,)) - cur.execute('DELETE from orgs WHERE username = ?', - (username,)) + if org == "NONE": + cur.execute('DELETE from orgs WHERE username = ?', + (username,)) leadercur = cur.execute('SELECT username from orgs WHERE orgName = ?', (orgName,)) leader = leadercur.fetchone() diff --git a/var/servicePoints.sqlite3 b/var/servicePoints.sqlite3 index 7e902472bdd1db5dde5b5971e4e42731a9aee50f..bf426cb1ca7b04a0d73fa1d08fcf065e2379ac4e 100644 GIT binary patch delta 623 zcmZuuJ&RL86n*balW3ALNO;H-jF4L9>&{1IAz~xDwMD@BxTB2<v9L_Czre7q2;wi0 z`~eFQs}*#Az@}HW+u8|h;exlA3-_LL&zyT#t7f%o-gfn9bNfL(`t<Yz9gbd9WN=zh z7@Q8@Z^t*j4wmajO|Na+?r2`W#5cIO^1NC+6R)3p;9_PIxa<WaZMlllI~$B)GRg?( z5X3AaaGRK8HlX1_Detm#0hx1{ol?ddtAqhGB5KZjP~IoMl$Lwt6&UG)PF$BhN2v`r zGBZdyhNw#uC1_+^*(|(eg~(#^R{ErLh-e*JXx5KOuPbph?-dvOzyCM=H537y&P%PV z$x2BN9uxNrIb^|52b@XB3d-;RmYHZ|)Jpq=9G%ND@sNZQEE;VRcxk+p+Iz@6T11<( zlZLs#f{GTHc0qs+T03i8VtVf$v}SyYvTPP4dd01FDLBR@7bX{gsjBMRX8q+D?tH&S z=vhU7(F=OE9Z!GId)G;~KiJ+S>67;Icuk+&>R(oeg-qy4MbGJuo)pe!dUs4n*InJo zpdsy~lyGryc<}J}{QjgU?JD}aDD4XCC!PGO)FYF64{Wv<hc~D7$AWlA>-lE=<PXtJ BvljpW delta 123 zcmZo@U}|V!njp={F;T{ukz-@RLVj)r1_nlcQwDxhzT(Y-3R!%NhbA`en`|n7o`aG9 z8w3A0{%@NF1D^6rasU-Fa577B=B1YB7p3!p^}T1{e-D<P{N7%a4Wa?af5X4|o4>FE Q<1(O$^Z6O0CN_ov03-(_T>t<8 -- GitLab