@@ -1918,27 +1918,28 @@ def update_contributions(
19181918
19191919 query = query or {}
19201920
1921- if not self .project and (not query or "project" not in query ):
1922- raise MPContribsClientError (
1923- "initialize client with project, or include project in query!"
1924- )
1925-
1926- if "project" in query and self .project != query ["project" ]:
1927- raise MPContribsClientError (
1928- f"client initialized with different project { self .project } !"
1929- )
1921+ if self .project :
1922+ if "project" in query and self .project != query ["project" ]:
1923+ raise MPContribsClientError (
1924+ f"client initialized with different project { self .project } !"
1925+ )
1926+ query ["project" ] = self .project
1927+ else :
1928+ if not query or "project" not in query :
1929+ raise MPContribsClientError (
1930+ "initialize client with project, or include project in query!"
1931+ )
19301932
1931- query ["project" ] = self . project
1932- cids = list (self .get_all_ids (query ).get (self . project , {}).get ("ids" , set ()))
1933+ name = query ["project" ]
1934+ cids = list (self .get_all_ids (query ).get (name , {}).get ("ids" , set ()))
19331935
19341936 if not cids :
1935- logger .info (f"There aren't any contributions to update for { self .project } " )
1936- return
1937+ raise MPContribsClientError (
1938+ f"There aren't any contributions to update for { name } "
1939+ )
19371940
19381941 # get current list of data columns to decide if swagger reload is needed
1939- resp = self .projects .getProjectByName (
1940- pk = self .project , _fields = ["columns" ]
1941- ).result ()
1942+ resp = self .projects .getProjectByName (pk = name , _fields = ["columns" ]).result ()
19421943 old_paths = set (c ["path" ] for c in resp ["columns" ])
19431944
19441945 total = len (cids )
@@ -1953,13 +1954,11 @@ def update_contributions(
19531954 updated = sum (resp ["count" ] for _ , resp in responses .items ())
19541955
19551956 if updated :
1956- resp = self .projects .getProjectByName (
1957- pk = self .project , _fields = ["columns" ]
1958- ).result ()
1957+ resp = self .projects .getProjectByName (pk = name , _fields = ["columns" ]).result ()
19591958 new_paths = set (c ["path" ] for c in resp ["columns" ])
19601959
19611960 if new_paths != old_paths :
1962- self .init_columns ()
1961+ self .init_columns (name = name )
19631962 self ._reinit ()
19641963
19651964 toc = time .perf_counter ()
0 commit comments