-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from DostEducation/develop
Release v1.0
- Loading branch information
Showing
13 changed files
with
174 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ DB_NAME= | |
DB_HOST= | ||
DB_PORT= | ||
SECRET_KEY= | ||
RETRY_LOGS_BATCH_LIMIT= | ||
MAX_RETRY_ATTEMPTS_FOR_LOGS= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
from __future__ import absolute_import | ||
|
||
from api import db | ||
from datetime import datetime | ||
|
||
|
||
class TimestampMixin(object): | ||
created_on = db.Column(db.DateTime, server_default=db.func.now()) | ||
updated_on = db.Column( | ||
db.DateTime, server_onupdate=db.func.now(), server_default=db.func.now() | ||
) | ||
created_on = db.Column(db.DateTime, default=datetime.now) | ||
updated_on = db.Column(db.DateTime, onupdate=datetime.now, default=datetime.now) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from api import models, helpers, db | ||
|
||
|
||
class UserProgramService(object): | ||
def __init__(self): | ||
self.user_id = None | ||
self.user_phone = None | ||
self.user_program_data = None | ||
|
||
def set_init_data(self, jsonData): | ||
user_phone = helpers.fetch_by_key("urn", jsonData["contact"]) | ||
self.user_phone = helpers.sanitize_phone_string(user_phone) | ||
user = models.User.query.get_by_phone(self.user_phone) | ||
self.user_id = user.id | ||
|
||
def mark_user_program_as_completed(self, JsonData): | ||
self.set_init_data(JsonData) | ||
self.user_program_data = models.UserProgram.get_by_user_id(self.user_id) | ||
|
||
if self.user_program_data: | ||
self.user_program_data.status = ( | ||
models.UserProgram.UserProgramStatus.COMPLETE | ||
) | ||
db.session.commit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters