def deal_sign_out_message(sign_time, manual_flag=False): """ Generate a message returned to the user when checking out. :param sign_time: The user's check-in time is a timestamp. :param manual_flag: Boolean value. True is manually enters time. :return: message content is a json. """ call_back = "sign_out" if manual_flag: call_back = "manual_sign_out" user_time = TimeStruct(sign_time) text = make_text("Register the current time {date}".format( date=user_time.date_time.strftime('%A, %B %-d ' 'at %-I:%M %P'))) if manual_flag: text = make_text( "Register the entered {date} as clock-out time?".format( date=user_time.date_time.strftime('%m, %-d %A ' 'at %-I:%M %P'))) reply_items = create_quick_replay_items( "confirm_out&time=" + user_time.str_current_time_tick, call_back) text["quickReply"] = make_quick_reply(reply_items) return text
def deal_sign_in_message(sign_time, manual_flag): """ Generate a message returned to the user when checking in. :param sign_time: The user's check-in time is a timestamp. :param manual_flag: Boolean value. True is manually enters time. :return: message content is a json. """ call_back = "sign_in" if manual_flag: call_back = "manual_sign_in" user_time = TimeStruct(sign_time) text = make_text("Register the current time {date} at {hours}:{min} " "{interval} as clock-in time?".format( date=user_time.date_time.strftime('%m, %d %A'), hours=user_time.hours, min=user_time.min, interval=user_time.interval_en)) if manual_flag: text = make_text("Register the entered {date} at {hours}:{min} " "{interval} as clock-in time?".format( date=user_time.date_time.strftime('%m, %d %A'), hours=user_time.hours, min=user_time.min, interval=user_time.interval_en)) reply_items = create_quick_replay_items( "confirm_in&time=" + user_time.str_current_time_tick, call_back) text["quickReply"] = make_quick_reply(reply_items) return text
def deal_sign_in_message(sign_time, manual_flag): """ Generate a message returned to the user when checking in. :param sign_time: The user's check-in time is a timestamp. :param manual_flag: Boolean value. True is manually enters time. :return: message content is a json. """ call_back = "sign_in" if manual_flag: call_back = "manual_sign_in" user_time = TimeStruct(sign_time) fmt = _("Register the current time {date} as clock-in time?") fmt1 = _("%A, %B %-d at %-I:%M %P") text = make_i18n_text("Register the current time {date} as clock-in time?", "direct_sign_in", fmt, fmt1=fmt1, date=user_time.date_time) if manual_flag: fmt = _("Register the entered {date} as clock-in time?") text = make_i18n_text("Register the entered {date} as clock-in time?", "direct_sign_in", fmt, fmt1=fmt1, date=user_time.date_time) reply_items = create_quick_replay_items( "confirm_in&time=" + user_time.str_current_time_tick, call_back) text["quickReply"] = make_quick_reply(reply_items) return text