Skip to content

Commit 3b1b380

Browse files
committed
Fix PR review comments: refactor duplicate code and remove console.logs
1 parent 09b0705 commit 3b1b380

File tree

7 files changed

+20
-36
lines changed

7 files changed

+20
-36
lines changed

src/App.vue

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ export default {
299299
// but there will be a change in responses that needs to trigger
300300
// this.setVisibility().
301301
if ((oldP !== newP) && newP === 100) {
302-
// console.log('time to check for branching activities!');
302+
//
303303
this.setVisbility();
304304
}
305305
},
@@ -518,16 +518,13 @@ export default {
518518
_.map(eachActivityList, (itemObj) => {
519519
const newObj = { ...itemObj };
520520
if (itemObj['@type'] === 'reproschema:Response') {
521-
if (itemObj.value instanceof Blob && itemObj.mimeType == "audio/wav") {
521+
if (itemObj.value instanceof Blob && (itemObj.mimeType === "audio/wav" || itemObj.mimeType === "video/mp4")) {
522522
const keyStrings = (itemObj.isAbout.split('/'));
523523
const rId = itemObj['@id'].split('uuid:')[1];
524-
jszip.folder(fileName).file(`${keyStrings[keyStrings.length-1]}-${rId}.wav`, itemObj.value); //changed from wav
525-
newObj.value = `${keyStrings[keyStrings.length-1]}-${rId}.wav`; //changed from wav
526-
} else if (itemObj.value instanceof Blob && itemObj.mimeType == "video/mp4") {
527-
const keyStrings = (itemObj.isAbout.split('/'));
528-
const rId = itemObj['@id'].split('uuid:')[1];
529-
jszip.folder(fileName).file(`${keyStrings[keyStrings.length-1]}-${rId}.mp4`, itemObj.value); //changed from wav
530-
newObj.value = `${keyStrings[keyStrings.length-1]}-${rId}.mp4`; //changed from wav
524+
const extension = itemObj.mimeType === "audio/wav" ? "wav" : "mp4";
525+
const filename = `${keyStrings[keyStrings.length-1]}-${rId}.${extension}`;
526+
jszip.folder(fileName).file(filename, itemObj.value);
527+
newObj.value = filename;
531528
}
532529
}
533530
activityData.push(newObj);
@@ -585,7 +582,7 @@ export default {
585582
'$1-$2-$3T$4:$5:$6Z'
586583
);
587584
const time = Date.parse(formattedTime);
588-
console.log(537, timestamp, formattedTime, time);
585+
// console.log(537, timestamp, formattedTime, time);
589586
return time;
590587
},
591588
showTimer() {
@@ -634,7 +631,7 @@ export default {
634631
if (!_.isEmpty(this.$store.state.schema)) {
635632
const order = _.map(this.$store.state.schema['http://schema.repronim.org/order'][0]['@list'],
636633
u => u['@id']);
637-
console.log(order)
634+
// console.log(order)
638635
return order;
639636
}
640637
return [];

src/components/InputSelector/InputSelector.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:init="init" v-on:valueChanged="sendData"/>
2323
</div>
2424

25-
<div v-else-if="inputType === 'audioCheck'">
25+
<div v-else-if="inputType === 'audioCheck' || inputType === 'audioVideoCheck'">
2626
<MediaRecord
2727
:constraints="valueConstraints"
2828
:selected_language="selected_language"
@@ -42,16 +42,6 @@
4242
v-on:valueChanged="sendData"/>
4343
</div>
4444

45-
<div v-else-if="inputType === 'audioVideoCheck'">
46-
<MediaRecord
47-
:constraints="valueConstraints"
48-
:selected_language="selected_language"
49-
:init="init"
50-
:audio="true"
51-
:visualizer="true"
52-
v-on:valueChanged="sendData"/>
53-
</div>
54-
5545
<div v-else-if="inputType.startsWith('audio')">
5646
<MediaRecord
5747
:constraints="valueConstraints"

src/components/Inputs/SaveData/SaveData.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,13 @@ export default {
117117
_.map(eachActivityList, (itemObj) => {
118118
const newObj = { ...itemObj };
119119
if (itemObj['@type'] === 'reproschema:Response') {
120-
if (itemObj.value instanceof Blob && itemObj.mimeType === "audio/wav") {
120+
if (itemObj.value instanceof Blob && (itemObj.mimeType === "audio/wav" || itemObj.mimeType === "video/mp4")) {
121121
const keyStrings = (itemObj.isAbout.split('/'));
122122
const rId = itemObj['@id'].split('uuid:')[1];
123-
jszip.folder(fileName).file(`${keyStrings[keyStrings.length-1]}-${rId}.wav`, itemObj.value); //changed from .wav
124-
newObj.value = `${keyStrings[keyStrings.length-1]}-${rId}.wav`; //changed from .wav
125-
} else if (itemObj.value instanceof Blob && itemObj.mimeType === "video/mp4") {
126-
const keyStrings = (itemObj.isAbout.split('/'));
127-
const rId = itemObj['@id'].split('uuid:')[1];
128-
jszip.folder(fileName).file(`${keyStrings[keyStrings.length-1]}-${rId}.mp4`, itemObj.value); //changed from .wav
129-
newObj.value = `${keyStrings[keyStrings.length-1]}-${rId}.mp4`; //changed from .wav
123+
const extension = itemObj.mimeType === "audio/wav" ? "wav" : "mp4";
124+
const filename = `${keyStrings[keyStrings.length-1]}-${rId}.${extension}`;
125+
jszip.folder(fileName).file(filename, itemObj.value);
126+
newObj.value = filename;
130127
}
131128
}
132129
activityData.push(newObj);
@@ -188,7 +185,7 @@ export default {
188185
},
189186
sendRetry(url, formData, index, retries = 3, backoff = 10000) {
190187
if (!this.shouldUpload) {
191-
console.log("Not uploading")
188+
192189
return 200;
193190
}
194191
const config1 = {

src/components/StudySign/StudySign.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default {
124124
this.$emit('valueChanged', 'disagree');
125125
},
126126
accept() {
127-
console.log(140, this.name);
127+
// console.log(140, this.name);
128128
this.$emit('valueChanged', this.name);
129129
},
130130
},

src/components/Survey/Survey.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@
507507
},
508508
async sendRetry(url, formData, retries = 3, backoff = 10000) {
509509
if (!this.shouldUpload) {
510-
console.log("Not uploading")
510+
// console.log("Not uploading")
511511
return;
512512
}
513513
const config1 = {
@@ -524,7 +524,7 @@
524524
}, backoff)
525525
}
526526
else {
527-
console.log(e.response.status);
527+
// console.log(e.response.status);
528528
}
529529
}
530530
}

src/components/Timer/Timer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
// this.statusText = this.wordString.status.running;
7575
7676
} else if( distance > 0 && passTime > 0 ){
77-
console.log(84);
77+
// console.log(84);
7878
this.calcTime(distance);
7979
this.message = this.wordString.upcoming;
8080
this.statusType = "upcoming";

src/store/store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const mutations = {
107107
// eslint-disable-next-line
108108
async setBaseSchema(state, data) {
109109
state.schema = data[0];
110-
console.log("state: ", state)
110+
// console.log("state: ", state)
111111
state.progress = _.map(data[0][`${state.termUrl}order`][0]['@list'], () => 0);
112112
state.responses = _.map(data[0][`${state.termUrl}order`][0]['@list'], () => ({}));
113113
state.exportResponses = _.map(data[0][`${state.termUrl}order`][0]['@list'], () => ([]));

0 commit comments

Comments
 (0)