Skip to content
Merged
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
11 changes: 2 additions & 9 deletions firebase/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,9 @@ admin.initializeApp()
// Increments or Decrements various counter
//
// Gets triggered when new results of the group are written to the database.
exports.counter = functions.database.ref('/v2/results/{projectId}/{groupId}/{userId}/').onWrite((snapshot, context) => {
// if result ref does not contain any data
// (e.g. when deletion during transfer_results() occured)
// do nothing
if (!snapshot.after.exists()) {
return null
}

exports.counter = functions.database.ref('/v2/results/{projectId}/{groupId}/{userId}/').onCreate((snapshot, context) => {
const promises = []
const result = snapshot.after.val()
const result = snapshot.val()

// if result ref does not contain all required attributes we don't updated counters
// e.g. due to some error when uploading from client
Expand Down