Skip to content

Commit f5aa42a

Browse files
simonseoKhaled AlHosani
authored andcommitted
Ignore header upon addpost() (#49)
* Ignore header upon addpost() * Went back to skul to learn english
1 parent 058e876 commit f5aa42a

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

bot/modules/about.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ module.exports = (bot) => {
99
bot.on('postback:MENU_ABOUT', (payload, chat) => {
1010
chat.getUserProfile()
1111
.then((user) => {
12-
chat.say(`Hey, ${user.first_name}! I know that acessing Student Portal can sometimes be a little bit annoying. With me, that will quickly go away!`, { typing:true })
12+
chat.say(`Hey, ${user.first_name}! I know that accessing Student Portal can sometimes be a little bit annoying. With me, that will quickly go away!`, { typing:true })
1313
.then(() => {
14-
chat.say('Simply click the button from the menu to subscribe or unsubscribe from notifications from categories in Student Portal.', { typing:true });
14+
chat.say('Simply click the button from the menu to subscribe to get notifications from Student Portal.', { typing:true });
1515
});
1616
});
1717
});

bot/modules/spammer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = (bot) => {
3030
function processRequest(e) {
3131
if (xmlHTTPSubscription.readyState == 4 && xmlHTTPSubscription.status == 200) {
3232
console.log(xmlHTTPSubscription.responseText);
33-
convo.say("Perfect! Your subscription has been saved!", { typing:true });
33+
convo.say("Perfect! You're now subscribed to the NYUAD Student Portal!", { typing:true });
3434
}
3535
}
3636

flask/databaseOperations.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
from sendPost import SendPost
66
def addpost(data):
77
postToAdd=Post(data)
8+
if postToAdd.updated not in ('0','1'):
9+
# row is not of expected value, probably a header
10+
return "Data was a header: {}".format(data)
11+
812
conn = sqlite3.connect('posts.db')
913
c = conn.cursor()
1014

flask/flaskapp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ def postJson():
8383
csvwriter.writerow(announcement.values())
8484
new_data.close()
8585

86-
# Put data into DB
87-
db.injectData(sorted(ReadCSV(filename),key= lambda x: x[17],reverse=True)) #x[17]where updated_at is
86+
# Put data into DB: Read temporary CSV as 2D list and give it to db module to handle
87+
db.injectData(ReadCSV(filename))
8888
return Response("We received something")
8989

9090
@app.route("/addUserSubscriptionAll", methods=['POST'])

flask/getUserSubs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99

1010
def getUserSubs(userID):
11+
# look through all posts and tell user of any new or updated announcements
1112
conn = sqlite3.connect('posts.db')
1213
c = conn.cursor()
1314
to_send={"posts":[]}

0 commit comments

Comments
 (0)