Merge branch 'main' of https://github.com/mgrove36/parandum into main
This commit is contained in:
@@ -104,11 +104,14 @@ export default withRouter(class GroupStats extends Component {
|
||||
if (groupSetIds.length > 0) await this.state.db.collection("incorrect_answers")
|
||||
.where("groups", "array-contains", this.props.match.params.groupId)
|
||||
.orderBy("term", "asc")
|
||||
.orderBy("definition", "asc")
|
||||
.get()
|
||||
.then((querySnapshot) => {
|
||||
let incorrectAnswers = [];
|
||||
querySnapshot.docs.map((doc, index, array) => {
|
||||
if (doc.data().setIds.some(item => groupSetIds.includes(item))) {
|
||||
const docs = querySnapshot.docs
|
||||
.filter((doc) => doc.data().setIds.some(item => groupSetIds.includes(item)));
|
||||
docs
|
||||
.map((doc, index, array) => {
|
||||
if (index === 0 || doc.data().term !== array[index - 1].data().term || doc.data().definition !== array[index - 1].data().definition) {
|
||||
incorrectAnswers.push({
|
||||
term: doc.data().term,
|
||||
@@ -143,12 +146,10 @@ export default withRouter(class GroupStats extends Component {
|
||||
doc.data().setIds.map((setId) => newState.setsWithHistory[setId] = true);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
newState.incorrectAnswers = incorrectAnswers.sort((a, b) => b.count + b.switchedCount - a.count - a.switchedCount);
|
||||
newState.filteredIncorrectAnswers = newState.incorrectAnswers;
|
||||
newState.totalIncorrect = querySnapshot.docs.length;
|
||||
newState.totalIncorrect = docs.length;
|
||||
})
|
||||
.catch((error) => {
|
||||
newState.incorrectAnswers = [];
|
||||
|
||||
@@ -67,6 +67,7 @@ export default class IncorrectHistory extends Component {
|
||||
this.state.db.collection("incorrect_answers")
|
||||
.where("uid", "==", this.state.user.uid)
|
||||
.orderBy("term", "asc")
|
||||
.orderBy("definition", "asc")
|
||||
.get()
|
||||
.then(async (querySnapshot) => {
|
||||
let incorrectAnswers = [];
|
||||
|
||||
Reference in New Issue
Block a user