Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix *values serializer to use the original model columns #76

Merged
merged 2 commits into from
Jan 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ before_install:
install:
- cd $TRAVIS_BUILD_DIR
- python setup.py sdist && version=$(python setup.py --version) && pushd dist && pip install odm2rest-${version}.tar.gz && popd
- cd $TRAVIS_BUILD_DIR/examples

script:
- if [[ $TEST_TARGET == 'default' ]]; then
python examples/manage.py test odm2rest;
python manage.py test odm2rest;
fi
- if [[ $TEST_TARGET == 'coding_standards' ]]; then
flake8 --max-line-length=105 odm2rest;
Expand Down
2 changes: 1 addition & 1 deletion odm2rest/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def get_datasetsvalues(**kwargs):
dsr_val = []

if isinstance(dataSetsValues, pd.DataFrame):
res = READ.getResults(ids=list(dataSetsValues.resultid.values))[0]
res = READ.getResults(ids=list(dataSetsValues.ResultID.values))[0]
res_type = res.ResultTypeCV.lower()

RVSerializer = None
Expand Down
20 changes: 10 additions & 10 deletions odm2rest/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import odm2api.ODM2.models as odm2_mod

from utils import (get_col, lower_keys)
from utils import get_col


def get_sertype_dict(odm2_model):
Expand Down Expand Up @@ -212,7 +212,7 @@ def get_sertype_dict(odm2_model):

# RESULT VALUES SERIALIZERS
# --- CategoricalResultValues Serializer ---
CategoricalResultValues_dct = lower_keys(get_sertype_dict(odm2_mod.CategoricalResultValues))
CategoricalResultValues_dct = get_sertype_dict(odm2_mod.CategoricalResultValues)
CategoricalResultValuesSerializer = type(
str('CategoricalResultValuesSerializer'),
(Serializer,),
Expand All @@ -221,7 +221,7 @@ def get_sertype_dict(odm2_model):


# --- MeasurementResultValues Serializer ---
MeasurementResultValues_dct = lower_keys(get_sertype_dict(odm2_mod.MeasurementResultValues))
MeasurementResultValues_dct = get_sertype_dict(odm2_mod.MeasurementResultValues)
MeasurementResultValuesSerializer = type(
str('MeasurementResultValuesSerializer'),
(Serializer,),
Expand All @@ -230,7 +230,7 @@ def get_sertype_dict(odm2_model):


# --- PointCoverageResultValues Serializer ---
PointCoverageResultValues_dct = lower_keys(get_sertype_dict(odm2_mod.PointCoverageResultValues))
PointCoverageResultValues_dct = get_sertype_dict(odm2_mod.PointCoverageResultValues)
PointCoverageResultValuesSerializer = type(
str('PointCoverageResultValuesSerializer'),
(Serializer,),
Expand All @@ -239,7 +239,7 @@ def get_sertype_dict(odm2_model):


# --- ProfileResultValues Serializer ---
ProfileResultValues_dct = lower_keys(get_sertype_dict(odm2_mod.ProfileResultValues))
ProfileResultValues_dct = get_sertype_dict(odm2_mod.ProfileResultValues)
ProfileResultValuesSerializer = type(
str('ProfileResultValuesSerializer'),
(Serializer,),
Expand All @@ -248,7 +248,7 @@ def get_sertype_dict(odm2_model):


# --- SectionResults Serializer ---
SectionResults_dct = lower_keys(get_sertype_dict(odm2_mod.SectionResults))
SectionResults_dct = get_sertype_dict(odm2_mod.SectionResults)
SectionResultsSerializer = type(
str('SectionResultsSerializer'),
(Serializer,),
Expand All @@ -257,7 +257,7 @@ def get_sertype_dict(odm2_model):


# --- SpectraResultValues Serializer ---
SpectraResultValues_dct = lower_keys(get_sertype_dict(odm2_mod.SpectraResultValues))
SpectraResultValues_dct = get_sertype_dict(odm2_mod.SpectraResultValues)
SpectraResultValuesSerializer = type(
str('SpectraResultValuesSerializer'),
(Serializer,),
Expand All @@ -266,7 +266,7 @@ def get_sertype_dict(odm2_model):


# ---TimeSeriesResultValues Serializer ---
TimeSeriesResultValues_dct = lower_keys(get_sertype_dict(odm2_mod.TimeSeriesResultValues))
TimeSeriesResultValues_dct = get_sertype_dict(odm2_mod.TimeSeriesResultValues)
TimeSeriesResultValuesSerializer = type(
str('TimeSeriesResultValuesSerializer'),
(Serializer,),
Expand All @@ -275,7 +275,7 @@ def get_sertype_dict(odm2_model):


# --- TrajectoryResultValues Serializer ---
TrajectoryResultValues_dct = lower_keys(get_sertype_dict(odm2_mod.TrajectoryResultValues))
TrajectoryResultValues_dct = get_sertype_dict(odm2_mod.TrajectoryResultValues)
TrajectoryResultValuesSerializer = type(
str('TrajectoryResultValuesSerializer'),
(Serializer,),
Expand All @@ -284,7 +284,7 @@ def get_sertype_dict(odm2_model):


# --- TransectResultValues Serializer ---
TransectResultValues_dct = lower_keys(get_sertype_dict(odm2_mod.TransectResultValues))
TransectResultValues_dct = get_sertype_dict(odm2_mod.TransectResultValues)
TransectResultValuesSerializer = type(
str('TransectResultValuesSerializer'),
(Serializer,),
Expand Down