Beispiel #1
0
 def _getQueryModel(self, **kwargs) -> QueryModel:
     qm = QueryModel()
     if "teams" in kwargs and kwargs["teams"] is not None:
         qm.cstart("team", kwargs["teams"], Operator.IN)
         if "include_previous_teams" in kwargs and kwargs[
                 "include_previous_teams"]:
             qm.cor("previous_teams", kwargs["teams"], Operator.IN)
     cmap = {
         "position":
         kwargs["positions"] if "positions" in kwargs else None,
         "last_name":
         kwargs["last_names"] if "last_names" in kwargs else None,
         "first_name":
         kwargs["first_names"] if "first_names" in kwargs else None,
         "profile_id":
         kwargs["profile_ids"] if "profile_ids" in kwargs else None
     }
     for name in cmap:
         if cmap[name] is not None:
             qm.cand(name, cmap[name], Operator.IN)
     if "player_abbreviations" in kwargs and kwargs[
             "player_abbreviations"] is not None:
         paqm = QueryModel()
         for pabb in kwargs["player_abbreviations"]:
             if not (pabb is None or pabb == ""):
                 curqm = QueryModel()
                 fi, ln = util.parseNameAbbreviation(pabb)
                 if not (fi is None and ln is None):
                     if fi is not None:
                         curqm.cstart("first_name", fi, Operator.REGEX, "i")
                     curqm.cand("last_name", ln, Operator.REGEX, "i")
                     paqm.cor(query_model=curqm)
         qm.cand(query_model=paqm)
     return qm
Beispiel #2
0
 def _getQueryModel(self, **kwargs) -> QueryModel:
     qm = QueryModel()
     if kwargs["teams"] is not None:
         qm.cstart("team", kwargs["teams"], Operator.IN)
         if "include_previous_teams" in kwargs and kwargs["include_previous_teams"]:
             qm.cor("previous_teams", kwargs["teams"], Operator.IN)
     cmap = {
         "last_name": kwargs["last_names"] if "last_names" in kwargs else None,
         "first_name": kwargs["first_names"] if "first_names" in kwargs else None,
         "profile_id": kwargs["profile_ids"] if "profile_ids" in kwargs else None
     }
     for name in cmap:
         if cmap[name] is not None:
             qm.cand(name, cmap[name], Operator.IN)
     return qm