Skip to content

If there is an error but videos were uploaded, show them. Added search Functionality (Fixed) #436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions public/tags/subjectTags.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{ "subject_tags": [
{ "value": "unimpaired", "label": "Unimpaired" },
{ "value": "alzheimers", "label": "Alzheimers" },
{ "value": "anterior_cruciate_ligament", "label": "Anterior Cruciate Ligament (ACL)"},
{ "value": "anterior_cruciate_ligament_replacement_left", "label": "Anterior Cruciate Ligament Replacement (ACLR) - Left"},
{ "value": "anterior_cruciate_ligament_replacement_right", "label": "Anterior Cruciate Ligament Replacement (ACLR) - Right"},
{ "value": "athlete", "label": "Athlete" },
{ "value": "blind", "label": "Blind" },
{ "value": "cerebral_palsy", "label": "Cerebral Palsy" },
Expand Down Expand Up @@ -31,6 +34,8 @@
{ "value": "post_partum", "label": "Postpartum" },
{ "value": "ptsd", "label": "Post-Traumatic Stress Disorder (PTSD)" },
{ "value": "pregnant", "label": "Pregnant" },
{ "value": "slipped_capital_femoral_epiphysis", "label": "Slipped Capital Femoral Epiphysis" },
{ "value": "spinal_cord_injury", "label": "Spinal Cord Injury (SCI)" },
{ "value": "spina_bifida", "label": "Spina Bifida" },
{ "value": "stroke", "label": "Stroke" },
{ "value": "stroke_left_hemiparesis", "label": "Stroke Left Hemiparesis" },
Expand Down
35 changes: 35 additions & 0 deletions src/components/pages/SelectSession.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@
</v-btn>

<v-checkbox v-model="show_trashed" class="ml-2 mt-0" label="Show removed sessions"></v-checkbox>

<v-text-field
v-model="searchText"
class="ml-2"
label="Enter text"
dense
></v-text-field>

<v-btn
class="ml-2"
@click="handleSearch">
Submit
</v-btn>
</div>

<v-data-table
Expand Down Expand Up @@ -279,6 +292,7 @@ export default {
sessionName: '',
sessionNewName: '',
show_trashed: false,
searchText: '',
headers: [
{
text: 'Session ID',
Expand Down Expand Up @@ -325,6 +339,27 @@ export default {
'restoreTrashedSession',
'loadAnalysisDashboardList',
]),
handleSearch() {
this.loading = true;
const params = new URLSearchParams({ text: this.searchText }).toString();Add commentMore actions
axios.get(`/sessions/search_sessions/?${params}`).then(response => {
const filteredSessions = response.data.filter(session => {
// Count trials that are NOT calibration
const nonCalibrationTrials = session.trials.filter(
trial => trial.name.toLowerCase() !== 'calibration'
);
// Keep the session only if there's at least one non-calibration trial
return nonCalibrationTrials.length > 0;
});

this.valid_sessions = filteredSessions;
this.session_total = filteredSessions.length;
this.loading = false;
}).catch(error => {
apiError(error)
this.loading = false
})
},
loadValidSessions () {
this.loading = true
let data = {
Expand Down
55 changes: 32 additions & 23 deletions src/components/pages/Session.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@
this.trial = null
this.synced = false
this.trialLoading = true

try {
const {data} = await axios.get(`/trials/${trial.id}/`)

Expand All @@ -1255,7 +1255,6 @@

// load JSON
const json = data.results.filter(element => element.tag == "visualizerTransforms-json")

if (json && json.length > 0) {
let data
const url = json[0].media
Expand Down Expand Up @@ -1286,18 +1285,26 @@

this.videos = data.results.filter(element => element.tag == "video-sync")

let render_skeleton = true

if (this.videos.length === 0) {
this.frame = 0
this.time = 0
this.videos = data.videos
this.videos.forEach(videoObj => {
videoObj.media = videoObj.video;
delete videoObj.video;
});
render_skeleton = false
}

if (this.frames.length > 0) {
if (this.frames.length > 0 || this.videos.length > 0) {
this.$nextTick(() => {
try {
while (this.$refs.mocap.lastChild) {
this.$refs.mocap.removeChild(this.$refs.mocap.lastChild)
}

// setup3d
const container = this.$refs.mocap

Expand Down Expand Up @@ -1373,26 +1380,28 @@
// const cameraHelper = new THREE.CameraHelper(light.shadow.camera);
// this.scene.add(cameraHelper);
}

// add bones
for (let body in this.animation_json.bodies) {
let bd = this.animation_json.bodies[body]
bd.attachedGeometries.forEach((geom) => {
let path = 'https://mc-opencap-public.s3.us-west-2.amazonaws.com/geometries/' + geom.substr(0, geom.length - 4) + ".obj";
objLoader.load(path, (root) => {
root.castShadow = true;
root.receiveShadow = true;
root.traverse(function (child) {
if (child instanceof THREE.Mesh) {
// child.receiveShadow = true;
child.castShadow = true;
}
});
this.meshes[body + geom] = root;
this.meshes[body + geom].scale.set(bd.scaleFactors[0], bd.scaleFactors[1], bd.scaleFactors[2])
this.scene.add(root);

if (render_skeleton) {
// add bones
for (let body in this.animation_json.bodies) {
let bd = this.animation_json.bodies[body]
bd.attachedGeometries.forEach((geom) => {
let path = 'https://mc-opencap-public.s3.us-west-2.amazonaws.com/geometries/' + geom.substr(0, geom.length - 4) + ".obj";
objLoader.load(path, (root) => {
root.castShadow = true;
root.receiveShadow = true;
root.traverse(function (child) {
if (child instanceof THREE.Mesh) {
// child.receiveShadow = true;
child.castShadow = true;
}
});
this.meshes[body + geom] = root;
this.meshes[body + geom].scale.set(bd.scaleFactors[0], bd.scaleFactors[1], bd.scaleFactors[2])
this.scene.add(root);
})
})
})
}
}
} finally {
this.trialLoading = false
Expand Down
3 changes: 2 additions & 1 deletion src/components/ui/Status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export default {

case 'error': {
const res = await axios.get(`/trials/${this.value.id}/`)
apiErrorRes(res, 'Error in processing, you may want to re-record this trial.')
apiErrorRes(res, 'Error in processing, you may want to re-record this trial.')
this.$emit('click')
break
}

Expand Down