Skip to content

Commit

Permalink
Regularly fetch respondent files status
Browse files Browse the repository at this point in the history
See #2350
  • Loading branch information
matiasgarciaisaia committed Oct 31, 2024
1 parent 31169b7 commit a5dda9b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion assets/js/components/respondents/RespondentIndex.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type Props = {

type State = {
shownFile: string,
filesFetchTimer: ?IntervalID,
}

class RespondentIndex extends Component<Props, State> {
Expand All @@ -76,7 +77,7 @@ class RespondentIndex extends Component<Props, State> {

constructor(props) {
super(props)
this.state = { shownFile: null }
this.state = { shownFile: null , filesFetchTimer: null }
this.toggleResultsLink = this.toggleResultsLink.bind(this)
this.toggleIncentivesLink = this.toggleIncentivesLink.bind(this)
this.toggleInteractionsLink = this.toggleInteractionsLink.bind(this)
Expand Down Expand Up @@ -140,6 +141,12 @@ class RespondentIndex extends Component<Props, State> {

// FIXME: don't fetch if we're already fetching
this.props.surveyActions.fetchRespondentsFilesStatus(projectId, surveyId, filter)
if (this.state.filesFetchTimer == null) {
const filesFetchTimer = setInterval(() => {
this.props.surveyActions.fetchRespondentsFilesStatus(projectId, surveyId, filter)
}, 20_000);
this.setState({ filesFetchTimer })
}
$('#downloadCSV').modal("open")
}

Expand Down

0 comments on commit a5dda9b

Please sign in to comment.