Skip to content

Commit

Permalink
Symptom fix (#150)
Browse files Browse the repository at this point in the history
* add error logs for invalid symptom inputs
* SymptomInputsManager.kt: copy/pase errors fixed
* Cargo.toml: version, authors update
  • Loading branch information
duskoo authored Aug 23, 2020
1 parent 663c4f9 commit ff0cefc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "coepi_core"
version = "0.1.0"
authors = ["theseriousadult <jack@gallabytes.com>, ivanschuetz <ivanhp978@gmail.com>"]
version = "0.1.35"
authors = ["theseriousadult <jack@gallabytes.com>, ivanschuetz <ivanhp978@gmail.com>, duskoo <dusko.ojdanic@gmail.com>"]
edition = "2018"

[lib]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class SymptomInputsManagerImpl(private val api: JniApi, private val gson: Gson)
}.asResult()

override fun setCoughStatus(input: UserInput<Cough.Status>): Result<Unit, Throwable> =
api.setCoughType(
api.setCoughStatus(
input.toJniStringInput {
when (it) {
BETTER_AND_WORSE_THROUGH_DAY -> "better_and_worse"
Expand Down Expand Up @@ -113,7 +113,7 @@ class SymptomInputsManagerImpl(private val api: JniApi, private val gson: Gson)
}

override fun setFeverTakenTemperatureSpot(input: UserInput<Fever.TemperatureSpot>): Result<Unit, Throwable> =
api.setCoughType(
api.setFeverTakenTemperatureSpot(
input.toJniStringInput {
when (it) {
is Armpit -> "armpit"
Expand Down
20 changes: 16 additions & 4 deletions src/reporting/symptom_inputs_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ where
"none" => UserInput::None,
"wet" => UserInput::Some(CoughType::Wet),
"dry" => UserInput::Some(CoughType::Dry),
_ => Err(format!("Not supported: {}", cough_type))?,
_ => {
error!("Not supported cough type: {}", cough_type);
Err(format!("Not supported cough type: {}", cough_type))?
}
};

debug!("Setting cough type: {:?}", input);
Expand All @@ -120,7 +123,10 @@ where
"better_and_worse" => UserInput::Some(CoughStatus::BetterAndWorseThroughDay),
"same_steadily_worse" => UserInput::Some(CoughStatus::SameOrSteadilyWorse),
"worse_outside" => UserInput::Some(CoughStatus::WorseWhenOutside),
_ => Err(format!("Not supported: {}", status))?,
_ => {
error!("Not supported cough status: {}", status);
Err(format!("Not supported cough status: {}", status))?
}
};

debug!("Setting cough status: {:?}", input);
Expand All @@ -141,7 +147,10 @@ where
}
"ground_own_pace" => UserInput::Some(BreathlessnessCause::GroundOwnPace),
"hurry_or_hill" => UserInput::Some(BreathlessnessCause::HurryOrHill),
_ => Err(format!("Not supported: {}", cause))?,
_ => {
error!("Not supported breathlessness cause: {}", cause);
Err(format!("Not supported breathlessness cause: {}", cause))?
}
};

debug!("Setting breathlessness cause: {:?}", input);
Expand Down Expand Up @@ -185,7 +194,10 @@ where
"ear" => UserInput::Some(TemperatureSpot::Ear),
"mouth" => UserInput::Some(TemperatureSpot::Mouth),
"other" => UserInput::Some(TemperatureSpot::Other),
_ => Err(format!("Not supported: {}", spot))?,
_ => {
error!("Not supported temperature spot: {}", spot);
Err(format!("Not supported temperature spot: {}", spot))?
}
};

debug!("Setting fever temperature spot: {:?}", input);
Expand Down

0 comments on commit ff0cefc

Please # to comment.