[FIX] data format when creating progress record

Was using dictionary as code duplicated from home page. Only one value is ever present so dictionary not required.
This commit is contained in:
2021-09-12 22:55:14 +01:00
parent 51b21d3541
commit f596a7a8aa

View File

@@ -264,16 +264,12 @@ export default withRouter(class SetPage extends React.Component {
this.setState({ this.setState({
loading: true, loading: true,
}) })
const setIds = Object.keys(this.state.selections)
.filter(x => this.state.selections[x]);
const totalTestQuestions = (await Promise.all(setIds.map((setId) => const totalTestQuestions = await this.state.db.collection("sets")
this.state.db.collection("sets") .doc(this.props.match.params.setId)
.doc(setId) .collection("vocab")
.collection("vocab") .get()
.get() .then(querySnapshot => querySnapshot.docs.length);
.then(querySnapshot => querySnapshot.docs.length)
))).reduce((a, b) => a + b);
this.setState({ this.setState({
showTestStart: false, showTestStart: false,
@@ -488,7 +484,7 @@ export default withRouter(class SetPage extends React.Component {
onSliderChange={this.changeSliderValue} onSliderChange={this.changeSliderValue}
switchLanguage={this.state.switchLanguage} switchLanguage={this.state.switchLanguage}
handleSwitchLanguageChange={this.handleSwitchLanguageChange} handleSwitchLanguageChange={this.handleSwitchLanguageChange}
loading={this.state.loading} loading={this.state.loading}
/> />
} }
{ {