Skip to content
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

Added a count for how many files a user has left for time mangement #278

Open
wants to merge 1 commit into
base: main
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
3 changes: 3 additions & 0 deletions audino/frontend/src/components/annotate/annotationWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ const AnnotationWindow = props => {
isRendering,
original_filename,
navButtonsEnabled,
count
} = state;

return (
<div>
<div className="h-100 mt-5 text-center">

<AlertSection
messages={[
{ message: errorUnsavedMessage, type: 'danger' },
Expand All @@ -44,6 +46,7 @@ const AnnotationWindow = props => {
: <Button id="add-edit-toggle-button" className="editRegion" variant="secondary" onClick={() => {setAddRegionMode(!state.addRegionMode)}}>Add Regions: Off</Button>
}
</div>
{` labeled ` + count.completed + ` out of ` + count.all}
</div>
}

Expand Down
34 changes: 29 additions & 5 deletions audino/frontend/src/pages/annotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ class Annotate extends React.Component {

this.initalState = {
colorChange: 0,
count: {
pending: 0,
completed: 0,
all: 0,
marked_review: 0
},
next_data_url: '',
next_data_id: -1,
isPlaying: false,
Expand All @@ -30,6 +36,7 @@ class Annotate extends React.Component {
labelsUrl: `/api/projects/${projectId}/labels`,
dataUrl: `/api/projects/${projectId}/data/${dataId}`,
segmentationUrl: `/api/projects/${projectId}/data/${dataId}/segmentations_batch`,
apiUrl: `/api/current_user/projects/${projectId}/data`,
isDataLoading: false,
wavesurfer: null,
zoom: 100,
Expand Down Expand Up @@ -118,11 +125,27 @@ class Annotate extends React.Component {
isDataLoading: false
});
});

this.getData()
}

/*componentWillUnmount() {
handleAllSegmentSave(this)
}*/
getData() {
let { apiUrl} = this.state;
apiUrl = `${apiUrl}?page=${1}&active=pending`;
axios({
method: 'get',
url: apiUrl
})
.then(response => {
const { count } = response.data;
this.setState({
count
});
})
.catch(error => {
console.error(error);
});
}

handleAlertDismiss(e) {
e.preventDefault(e);
Expand Down Expand Up @@ -207,13 +230,14 @@ class Annotate extends React.Component {
}

nextPage(nextDataId) {
const { wavesurfer, projectId } = this.state;
const { wavesurfer, projectId, count } = this.state;
const newState = this.initalState;
newState.labelsUrl = `/api/projects/${projectId}/labels`;
newState.dataUrl = `/api/projects/${projectId}/data/${nextDataId}`;
newState.segmentationUrl = `/api/projects/${projectId}/data/${nextDataId}/segmentations_batch`;
newState.dataId = nextDataId;
newState.wavesurfer = null;
newState.count = count

wavesurfer.destroy();
this.setState(newState, () => {
Expand Down Expand Up @@ -253,7 +277,7 @@ class Annotate extends React.Component {
}

//console.log(maxHeight)
const { wavesurferMethods, disappear, showActiveForm, sideMenuEnabled, sideMenuOn } =
const { wavesurferMethods, disappear, showActiveForm, sideMenuEnabled, sideMenuOn, count } =
this.state;

if (wavesurferMethods) {
Expand Down