Exemplo n.º 1
0
        elif notify_type == 4 or notify_type == 2:
            res = Assignment.get_assignments_after(ndata['account_id'],
                                                   ndata['created_ts'])
            for idx in xrange(0, len(res)):
                title = res[idx].get("title")
                atype = res[idx].get("assignment_type")

                if atype == 4 and len(title) > 64:
                    title = title[0:64].strip()

                if "Past Due" in res[idx].get("due"):
                    pass
                    #msg = """{}:\n{}\n{}...""".format( res[idx].get("course_name"),res[idx].get("due"),title)
                    #sms.send(msg,ndata['notification_sms'])
                else:
                    if atype == 2:
                        atypestr = "Todo"
                    else:
                        atypestr = "Agenda"

                    msg = """{} - {}:\nDue: {}\n{}...""".format(
                        atypestr, res[idx].get("course_name"),
                        res[idx].get("due"), title)
                    sms.send(msg, ndata['notification_sms'])

        elif notify_type == 5:
            sms.send("EchoAlert: Asset has been updated",
                     ndata['notification_sms'])

    Notifier.mark_sent(ndata['id'], "Message sent successfully")