Skip to content

Commit

Permalink
closes #102, Merge pull request NCUAppTeam#105 from 1989ONCE/main
Browse files Browse the repository at this point in the history
sort participant list in manage screen
  • Loading branch information
1989ONCE authored Dec 8, 2023
2 parents 900e49e + 1cf5aa0 commit cdc5031
Show file tree
Hide file tree
Showing 5 changed files with 9,735 additions and 22,076 deletions.
16 changes: 10 additions & 6 deletions controller/Active.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,23 +732,27 @@ async function deleteOneActive (deleteDocId) {

async function getAllAttendees (docID) {
const db = getFirestore(app)
const infoRef = query(collection(db, 'attendees'))
const activesDoc = doc(db, `activities/${docID}`)

const querySnapshot = await getDocs(infoRef)
const activesSnapshot = await getDoc(activesDoc)
const IDlist = activesSnapshot.data().participant
let info = []

for (let j = 0; j < IDlist.length; j += 1) {
const infoDoc = doc(db, `attendees/${IDlist[j]}`)
const querySnapshot2 = await getDoc(infoDoc)
const querySnapshot = await getDoc(infoDoc)
const signUpTime = await getDoc(doc(db, `attendees/${IDlist[j]}/attendedEvent/${docID}`))
info.push({
uid: querySnapshot2.id,
...querySnapshot2.data()
uid: querySnapshot.id,
signupTimestamp: signUpTime.data().signUpTime,
signUpTime: toDateString(signUpTime.data().signUpTime.toDate()),
...querySnapshot.data()
})
}
return info
console.log(info)
// 按照報名時間排序 - 由先報名的 到 後報名的
var sortedInfo = info.sort((a, b) => { return a.signupTimestamp - b.signupTimestamp })
return sortedInfo
}

/**
Expand Down
Loading

0 comments on commit cdc5031

Please sign in to comment.