Skip to content

Commit

Permalink
Merge pull request #129 from lsetiawan/proc_lvl
Browse files Browse the repository at this point in the history
Fix Processing Levels code and docstring
  • Loading branch information
lsetiawan authored Nov 22, 2017
2 parents dd1ec35 + 89a7b95 commit 5bf911c
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions odm2api/ODM2/services/readService.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,28 @@ def getMethods(self, ids=None, codes=None, type=None):
# ProcessingLevel
def getProcessingLevels(self, ids=None, codes=None):
"""
getProcessingLevels(self, ids=None, codes=None)
* Pass nothing - returns full list of ProcessingLevel objects
* Pass a list of ProcessingLevelID - returns a single processingLevel object for each given id
* Pass a list of ProcessingLevelCode - returns a single processingLevel object for each given code
Retrieve a list of Processing Levels
If no arguments are passed to the function, or their values are None,
all Processing Levels objects in the database will be returned.
Args:
ids (list, optional): List of Processing Levels IDs.
codes (list, optional): List of Processing Levels Codes.
Returns:
list: List of ProcessingLevels Objects
Examples:
>>> READ = ReadODM2(SESSION_FACTORY)
>>> READ.getProcessingLevels(ids=[1, 3])
>>> READ.getProcessingLevels(codes=['L1', 'L3'])
"""
q = self._session.query(ProcessingLevels)
if ids:
q = q.filter(ProcessingLevels.ProcessingLevelsID.in_(ids))
q = q.filter(ProcessingLevels.ProcessingLevelID.in_(ids))
if codes:
q = q.filter(ProcessingLevels.ProcessingLevelCode.in_(codes))

Expand Down

0 comments on commit 5bf911c

Please sign in to comment.