Commit 84ea0461 authored by Wei Shoulin's avatar Wei Shoulin
Browse files

get latest cal

parent f7f0aa8a
...@@ -24,6 +24,17 @@ class CalMergeApi(object): ...@@ -24,6 +24,17 @@ class CalMergeApi(object):
:returns: csst_dfs_common.models.Result :returns: csst_dfs_common.models.Result
''' '''
return self.stub.find(**kwargs) return self.stub.find(**kwargs)
def get_latest_by_l0(self, **kwargs):
''' retrieve calibration merge records from database by level0 data
:param kwargs: Parameter dictionary, key items support:
level0_id: [str],
ref_type: [str]
:returns: csst_dfs_common.models.Result
'''
return self.stub.get_latest_by_l0(**kwargs)
def get(self, **kwargs): def get(self, **kwargs):
''' fetch a record from database ''' fetch a record from database
......
...@@ -15,6 +15,10 @@ class CalMergeApiTestCase(unittest.TestCase): ...@@ -15,6 +15,10 @@ class CalMergeApiTestCase(unittest.TestCase):
obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13")) obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13"))
print('find:', recs) print('find:', recs)
def test_get_latest_by_l0(self):
rec = self.api.get_latest_by_l0(level0_id='000001102', ref_type = "bias")
print('get_latest_by_l0:', rec)
def test_get(self): def test_get(self):
rec = self.api.get(id = 3) rec = self.api.get(id = 3)
print('get by id:', rec) print('get by id:', rec)
......
...@@ -30,9 +30,9 @@ class Level0DataTestCase(unittest.TestCase): ...@@ -30,9 +30,9 @@ class Level0DataTestCase(unittest.TestCase):
def test_write(self): def test_write(self):
rec = self.api.write( rec = self.api.write(
level0_id = '000001102', level0_id = '000001101',
obs_id = '0000011', obs_id = '0000011',
detector_no = "02", detector_no = "01",
obs_type = "sci", obs_type = "sci",
obs_time = "2021-06-06 11:12:13", obs_time = "2021-06-06 11:12:13",
exp_time = 150, exp_time = 150,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment