forked from yaso_meth/mih-project
@@ -33,7 +33,10 @@ class MihMzansiDirectoryServices {
|
||||
List<BusinessReview> businessReviews = List<BusinessReview>.from(
|
||||
l.map((model) => BusinessReview.fromJson(model)));
|
||||
return businessReviews;
|
||||
} else {
|
||||
} else if (response.statusCode == 404){
|
||||
return [];
|
||||
}
|
||||
else {
|
||||
throw Exception('failed to fetch Business Reviews');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: mzansi_innovation_hub
|
||||
description: ""
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
version: 1.1.13+87
|
||||
version: 1.1.13+88
|
||||
|
||||
environment:
|
||||
sdk: '>=3.5.3 <4.0.0'
|
||||
|
||||
@@ -13,7 +13,7 @@ encoded_dbPass = quote_plus(dbPass)
|
||||
base_connect_url = f"mysql+mysqlconnector://{dbUser}:{encoded_dbPass}@{dbHost}:{dbPort}/"
|
||||
|
||||
def dbPatientManagerConnect():
|
||||
return create_engine(base_connect_url+"patient_manager", echo=True, pool_recycle=3600)
|
||||
return create_engine(base_connect_url+"patient_manager", echo=False, pool_recycle=3600)
|
||||
# return mysql.connector.connect(
|
||||
# host="mysqldb",
|
||||
# user=dbUser,
|
||||
@@ -22,7 +22,7 @@ def dbPatientManagerConnect():
|
||||
# )
|
||||
|
||||
def dbAppDataConnect():
|
||||
return create_engine(base_connect_url+"app_data", echo=True, pool_recycle=3600)
|
||||
return create_engine(base_connect_url+"app_data", echo=False, pool_recycle=3600)
|
||||
# return mysql.connector.connect(
|
||||
# host="mysqldb",
|
||||
# user=dbUser,
|
||||
@@ -31,7 +31,7 @@ def dbAppDataConnect():
|
||||
# )
|
||||
|
||||
def dbDataAccessConnect():
|
||||
return create_engine(base_connect_url+"data_access", echo=True, pool_recycle=3600)
|
||||
return create_engine(base_connect_url+"data_access", echo=False, pool_recycle=3600)
|
||||
# return mysql.connector.connect(
|
||||
# host="mysqldb",
|
||||
# user=dbUser,
|
||||
@@ -40,7 +40,7 @@ def dbDataAccessConnect():
|
||||
# )
|
||||
|
||||
def dbMzansiWalletConnect():
|
||||
return create_engine(base_connect_url+"mzansi_wallet", echo=True, pool_recycle=3600)
|
||||
return create_engine(base_connect_url+"mzansi_wallet", echo=False, pool_recycle=3600)
|
||||
# return mysql.connector.connect(
|
||||
# host="mysqldb",
|
||||
# user=dbUser,
|
||||
@@ -49,7 +49,7 @@ def dbMzansiWalletConnect():
|
||||
# )
|
||||
|
||||
def dbMzansiDirectoryConnect():
|
||||
return create_engine(base_connect_url+"mzansi_directory", echo=True, pool_recycle=3600)
|
||||
return create_engine(base_connect_url+"mzansi_directory", echo=False, pool_recycle=3600)
|
||||
# return mysql.connector.connect(
|
||||
# host="mysqldb",
|
||||
# user=dbUser,
|
||||
@@ -58,7 +58,7 @@ def dbMzansiDirectoryConnect():
|
||||
# )
|
||||
|
||||
def dbMzansiCalendarConnect():
|
||||
return create_engine(base_connect_url+"mzansi_calendar", echo=True, pool_recycle=3600)
|
||||
return create_engine(base_connect_url+"mzansi_calendar", echo=False, pool_recycle=3600)
|
||||
# return mysql.connector.connect(
|
||||
# host="mysqldb",
|
||||
# user=dbUser,
|
||||
@@ -67,7 +67,7 @@ def dbMzansiCalendarConnect():
|
||||
# )
|
||||
|
||||
def dbAllConnect():
|
||||
return create_engine(base_connect_url, echo=True, pool_recycle=3600)
|
||||
return create_engine(base_connect_url, echo=False, pool_recycle=3600)
|
||||
# return mysql.connector.connect(
|
||||
# host="mysqldb",
|
||||
# user=dbUser,
|
||||
|
||||
@@ -209,7 +209,10 @@ async def Delete_loyalty_card(itemRequest : BusinessRatingDeleteRequest, session
|
||||
dbSession.delete(rating_to_delete)
|
||||
dbSession.flush() # Ensure the new rating is added to the session
|
||||
# Calc New Rating and update business rating
|
||||
newRating = ((float(itemRequest.current_rating) * businessReviewCount) - float(itemRequest.rating_score)) / (businessReviewCount - 1)
|
||||
if(businessReviewCount <= 1):
|
||||
newRating = "0.0"
|
||||
else:
|
||||
newRating = ((float(itemRequest.current_rating) * businessReviewCount) - float(itemRequest.rating_score)) / (businessReviewCount - 1)
|
||||
businessToUpdate = dbSession.query(Business).filter(Business.business_id == itemRequest.business_id).first()
|
||||
if businessToUpdate:
|
||||
businessToUpdate.rating = str(newRating)
|
||||
|
||||
Reference in New Issue
Block a user