Skip to content

Commit

Permalink
Merge pull request #98 from csus190teamtbd/matthewmerrill_twomeanalert
Browse files Browse the repository at this point in the history
alert message for invalid twoMean input
  • Loading branch information
MatthewMerrill committed May 8, 2019
2 parents caa4476 + ecdca6e commit 05e4793
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/_data/translate.yml
Expand Up @@ -94,6 +94,7 @@ en:
twoTail: Two Tails
twoMean:
Samples: Samples
alertAtLeastOne: Group 1 and Group 2 must both have at least one element.
diffOfMean: 'Difference of Means (Mean 1 - Mean 2):'
diffOfSampleMean: 'Difference of Means (Randomized Samples):'
differences: Differences
Expand Down Expand Up @@ -249,6 +250,7 @@ es:
twoTail: Dos colas
twoMean:
Samples: Muestras
alertAtLeastOne: Grupo 1 y Grupo 2 tienen que tener ambos al menos un elemento.
diffOfMean: 'Diferencia entre Medias (Media 1 - Media 2):'
diffOfSampleMean: 'Differencia entre medias (de muestras aleatorizadas):'
differences: Diferencias
Expand Down
1 change: 1 addition & 0 deletions src/translationSource/translationData.csv
Expand Up @@ -105,6 +105,7 @@ Original Dataset Difference of Means: Diferencia de Medias en Datos Originales:
Mean of Sample Differences: Media de las Diferencias: twoMean.meanSampleDiff
Standard Deviation: Desviación Estándar: twoMean.stdSampleDiff
Proportion of Extreme Differences Proporción de Diferencias Extremas: twoMean.proportionSelcted
Group 1 and Group 2 must both have at least one element. Grupo 1 y Grupo 2 tienen que tener ambos al menos un elemento. twoMean.alertAtLeastOne
Two Proportions Dos Proporciones twoProportions.title
Enter Data: Teclee los Datos twoProportions.enterData
Group A Grupo A twoProportions.groupA
Expand Down
8 changes: 6 additions & 2 deletions src/twoMean/twoMean.js
Expand Up @@ -102,7 +102,12 @@ export class TwoMean {

loadData() {
let rawData = this.parseData(this.csvInput.value.trim());
this.updateData(rawData);
if (!rawData[0] || !rawData[0].length || !rawData[1] || !rawData[1].length) {
alert(translation.twoMean.alertAtLeastOne);
}
else {
this.updateData(rawData);
}
}

parseData(dataText) {
Expand Down Expand Up @@ -130,7 +135,6 @@ export class TwoMean {
this.sampleDiffs = [];

let dataValues = data[0].concat(data[1]);
console.log(dataValues);
if (dataValues.length) {
let min = Math.min.apply(undefined, dataValues);
let max = Math.max.apply(undefined, dataValues);
Expand Down

0 comments on commit 05e4793

Please sign in to comment.