Skip to content

Commit

Permalink
Replace positive and negative text with result
Browse files Browse the repository at this point in the history
  • Loading branch information
setumartin committed Mar 3, 2020
1 parent 8b66c06 commit 69b9fe8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 27 deletions.
48 changes: 31 additions & 17 deletions src/screens/GIPScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,37 @@ export default class GIPScreen extends React.Component{
saveData(goHome){
let tmpDateTime = this.state.selectedDateAndTime
tmpDateTime.setFullYear(tmpDateTime.getFullYear());
FileSystem.readAsStringAsync(this.state.photo.uri,
{'encoding': FileSystem.EncodingType.Base64})
.then(result => {
this.state.photo.base46 = result;
DatabaseManager.getInstance().createGIPEvent(
this.state.gipManualResult,
this.state.gipEntryNote,
this.state.photo,
tmpDateTime.getTime(),
(error) => {alert(error)},
() => {
GlutonManager.getInstance().setMessage(2);
GearManager.getInstance().sendMessage("msg 31")
}
);
})
.catch((err) => alert(error))
if (this.state.photo) {
FileSystem.readAsStringAsync(this.state.photo.uri,
{'encoding': FileSystem.EncodingType.Base64})
.then(result => {
this.state.photo.base46 = result;
DatabaseManager.getInstance().createGIPEvent(
this.state.gipManualResult,
this.state.gipEntryNote,
this.state.photo,
tmpDateTime.getTime(),
(error) => {alert(error)},
() => {
GlutonManager.getInstance().setMessage(2);
GearManager.getInstance().sendMessage("msg 31")
}
);
})
.catch((err) => alert(error))
} else {
DatabaseManager.getInstance().createGIPEvent(
this.state.gipManualResult,
this.state.gipEntryNote,
this.state.photo,
tmpDateTime.getTime(),
(error) => {alert(error)},
() => {
GlutonManager.getInstance().setMessage(2);
GearManager.getInstance().sendMessage("msg 31")
}
);
}
if (goHome) {
setTimeout(() => this.navigateHome(), 100);
}
Expand Down
21 changes: 11 additions & 10 deletions src/screens/GIPViewScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,28 @@ export default class FoodViewScreen extends React.Component {
accuracyPercentText: 100,
dateValue: new Date(resultDate).getUTCDate() + '/' + (new Date(resultDate).getUTCMonth()+1) + '/' + new Date(resultDate).getUTCFullYear(),
timeValue: new Date(resultDate).getUTCHours() + ':' + new Date(resultDate).getUTCMinutes(),
resultState: objData.result };
resultState: objData.result
};

switch(objData.result) {
case 1:
displayBlock.resultValue = 'Negative';
displayBlock.accuracyPercentText = 95;
displayBlock.resultState = 0;
break;
case 0:
displayBlock.resultValue = 'Positive';
displayBlock.accuracyPercentText = 95;
displayBlock.resultValue = 'Gluten';
displayBlock.accuracyPercentText = 100;
displayBlock.resultState = 1;
break;
case 1:
displayBlock.resultValue = 'No gluten';
displayBlock.accuracyPercentText = 100;
displayBlock.resultState = 0;
break;
case 2:
displayBlock.resultValue = 'Inconclusive';
displayBlock.accuracyPercentText = 55;
displayBlock.accuracyPercentText = 50;
displayBlock.resultState = 2;
break;
default:
displayBlock.resultValue = 'Inconclusive';
displayBlock.accuracyPercentText = 55;
displayBlock.accuracyPercentText = 50;
displayBlock.resultState = 2;
}
const tags = [
Expand Down

0 comments on commit 69b9fe8

Please sign in to comment.