Skip to content

Commit 1148f36

Browse files
- FIX: Fixed issues with input of numeric values when using the numpad (keycode 110).
1 parent 3449862 commit 1148f36

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

src/components/TraitInput.vue

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -214,25 +214,25 @@ export default {
214214
}
215215
},
216216
methods: {
217-
preventNonNumber: function (evt) {
218-
if (evt.keyCode === 69) {
219-
evt.preventDefault()
220-
} else if (evt.keyCode === 110) {
221-
// Comma/fullstop on keypad
222-
evt.target.type = 'text'
223-
const start = evt.target.selectionStart
224-
const end = evt.target.selectionEnd
225-
const oldValue = evt.target.value
226-
227-
const newValue = oldValue.slice(0, start) + '.' + oldValue.slice(end)
228-
evt.target.value = newValue
229-
this.value = newValue
230-
231-
evt.target.selectionStart = start + 1
232-
evt.target.selectionEnd = start + 1
233-
evt.target.type = 'number'
234-
235-
evt.preventDefault()
217+
preventNonNumber: function (event) {
218+
if (event.keyCode === 69) {
219+
event.preventDefault()
220+
} else if (event.keyCode === 110) {
221+
// // Comma/fullstop on keypad
222+
// event.target.type = 'text'
223+
// const start = event.target.selectionStart
224+
// const end = event.target.selectionEnd
225+
// const oldValue = event.target.value
226+
227+
// const newValue = oldValue.slice(0, start) + '.' + oldValue.slice(end)
228+
// event.target.value = newValue
229+
// this.value = newValue
230+
231+
// event.preventDefault()
232+
233+
// nextTick(() => {
234+
// event.target.selectionEnd = event.target.selectionStart = start + 1
235+
// })
236236
}
237237
},
238238
setGps: function (latitude, longitude) {

src/plugins/misc.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ const trialsDataToLongFormat = (data, trial, aggregate = true, includePeople = f
557557
}
558558

559559
const trialsDataToMatrix = (data, trial, aggregate = true) => {
560-
let result = `Line/Trait\tRep\tRow\tColumn\tDate\t${trial.traits.map(t => t.name).join('\t')}\tLatitude\tLongitude`
560+
let result = `Line/Trait\tRep\tRow\tColumn\tSet\tDate\t${trial.traits.map(t => t.name).join('\t')}\tLatitude\tLongitude`
561561

562562
if (aggregate) {
563563
Object.values(data).forEach(v => {
@@ -574,7 +574,7 @@ const trialsDataToMatrix = (data, trial, aggregate = true) => {
574574
const dateArray = [...dates].sort((a, b) => a.localeCompare(b))
575575

576576
dateArray.forEach(date => {
577-
result += `\n${germplasmMeta}\t${date}`
577+
result += `\n${germplasmMeta}\t\t${date}`
578578

579579
trial.traits.forEach(t => {
580580
const td = v.measurements[t.id]
@@ -625,9 +625,10 @@ const trialsDataToMatrix = (data, trial, aggregate = true) => {
625625
.filter(val => val !== undefined && val !== null && val !== '')
626626

627627
if (values && values.length > 0) {
628-
values.forEach(val => {
628+
values.forEach((val, setPosition) => {
629629
measurements.push({
630630
traitId: t.id,
631+
setPosition,
631632
date: dp.timestamp.split('T')[0],
632633
value: t.dataType === 'categorical' ? t.restrictions.categories[+val] : val,
633634
geography: v.geography
@@ -640,7 +641,7 @@ const trialsDataToMatrix = (data, trial, aggregate = true) => {
640641

641642
measurements.forEach(m => {
642643
const values = trial.traits.map(t => `${t.id === m.traitId ? m.value : ''}`).join('\t')
643-
result += `\n${germplasmMeta}\t${m.date}\t${values}`
644+
result += `\n${germplasmMeta}\t${m.setPosition + 1}\t${m.date}\t${values}`
644645

645646
if (m.geography) {
646647
result += getLatLngAverage(m.geography)

src/views/TrialExportView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,14 @@ export default {
407407
},
408408
exportTrialLayout: function () {
409409
if (this.trial.layout && this.trialData) {
410-
let result = 'Germplasm\tRep\tRow\tColumn\tTreatment\tBarcode\tFriendly name'
410+
let result = 'Germplasm\tRep\tRow\tColumn\tTreatment\tFriendly name\tBarcode\tPedigree'
411411
412412
for (let row = 0; row < this.trial.layout.rows; row++) {
413413
for (let column = 0; column < this.trial.layout.columns; column++) {
414414
const c = this.trialData[`${row}|${column}`]
415415
416416
if (c) {
417-
result += `\n${c.germplasm}\t${c.rep || ''}\t${c.displayRow}\t${c.displayColumn}\t${c.treatment || ''}\t${c.barcode || ''}\t${c.friendlyName || ''}`
417+
result += `\n${c.germplasm}\t${c.rep || ''}\t${c.displayRow}\t${c.displayColumn}\t${c.treatment || ''}\t${c.friendlyName || ''}\t${c.barcode || ''}\t${c.pedigree || ''}`
418418
}
419419
}
420420
}

0 commit comments

Comments
 (0)