-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add list of members who didn't show up #16
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,6 +119,12 @@ setInterval(() => { | |
}, | ||
{ merge: true } | ||
) | ||
db.collection("members") | ||
doc("sourceStatus") | ||
.update( | ||
{ | ||
reporter: false | ||
}) | ||
} | ||
} | ||
}, 1000 * 60) | ||
|
@@ -196,6 +202,37 @@ setInterval(async () => { | |
let memberData = memberDoc.data() as MemberData | ||
if (memberData[date].timeStamp === undefined) { | ||
let reporterName = memberData[date].reporter | ||
const optKeyboard: telegramBot.SendMessageOptions = { | ||
parse_mode: "Markdown", | ||
reply_markup: { | ||
keyboard: [[{ text: "Source Did not respond yet" }], [{ text: "Did not asked the report yet" }]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Second message could be "Did not ask the source yet" for better clarity. Feel free to suggest a different sentence There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool 🙌 |
||
} | ||
} | ||
const optRemove: telegramBot.SendMessageOptions = { | ||
reply_markup: { | ||
remove_keyboard: true | ||
} | ||
} | ||
await bot.sendMessage( | ||
memberNameChatIdMap[reporterName], | ||
`Just in case your source didn't show up, let us know.`, | ||
optKeyboard | ||
) | ||
var chatId = parseInt(memberNameChatIdMap[reporterName]) | ||
responseCallbacks[chatId] = async response => { | ||
var status = (response.text == "Source Did not respond yet") ? true : false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I understand this, User gets a message asking whether source showed up yet or they have to contacted the source yet and after that we send a message saying "just in case source didn't show up, let us know" and we leave the bot hanging and expecting a reply until it sends a message to them again? I was thinking that this could just be a simple question asked to the user and they could press on "yes" or "no" buttons instead of taking in a sentence input and match it verbatim with "Source Did not respond yet" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool, I'll change it . |
||
db.collection("members") | ||
.doc("sourceStatus") | ||
.update({ | ||
reporterName: status | ||
} | ||
) | ||
bot.sendMessage( | ||
memberNameChatIdMap[reporterName], | ||
`Alright, Thanks!`, | ||
optRemove | ||
) | ||
} | ||
bot.sendMessage( | ||
memberNameChatIdMap[reporterName], | ||
`Hey there, This is a gentle reminder. Please submit your report soon using the /report command.` | ||
|
@@ -223,6 +260,15 @@ setInterval(async () => { | |
for (let idx = 0; idx < source.length; idx++) { | ||
let member = source[idx] | ||
const membersData = await db.collection("members").doc(member).get() | ||
var sources = await db.collection("members") | ||
.doc("sourceStatus") | ||
.get() | ||
.then( query => { | ||
query._fieldsProto[source[idx]].booleanValue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you paste a link to a document related to this function |
||
}) | ||
|
||
sources && sourceNames.push(source[idx]) | ||
|
||
const memberData = membersData.data() as MemberData | ||
if (memberData[date].timeStamp === undefined) { | ||
reporterNames.push(memberData[date].reporter) | ||
|
@@ -239,6 +285,10 @@ setInterval(async () => { | |
oslGroupId, | ||
`Those who have not submitted the report yet:\n${reporterNames.join( | ||
"\n" | ||
)} | ||
\n\n | ||
Those who did not respond to their reporters yet:\n${sourceNames.join( | ||
"\n" | ||
)}` | ||
) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this supposed to be .doc("sourceStatus") ?
Looks like there's a missing dot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes , Will add that 👍