Commit 69a07a04 authored by Lihinikaduwa D.N.R.  's avatar Lihinikaduwa D.N.R.

Merge branch 'it18257632' into 'master'

It18257632

See merge request !88
parents 69a896d7 67976c4c
......@@ -5,7 +5,7 @@
<excludeFolder url="file://$MODULE_DIR$/venv" />
<excludeFolder url="file://$MODULE_DIR$/API/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N802" />
<option value="N806" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N802" />
<option value="N806" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
from flask import Flask, redirect, url_for, render_template, request, jsonify, make_response
from API.model.colorModel import get_color_activities
from API.model.readModel import get_reading_activities
from API.routers.router import funtion_one
app = Flask(__name__)
# Initial Route
@app.route("/")
def home():
return render_template('home.html')
# Color Function Route (IT18218640)
@app.route("/getColorActivities")
def getColorActivities():
......@@ -19,11 +22,17 @@ def getColorActivities():
# Read Function Route (IT)
@app.route("/testings")
def checkothers():
return "testing funtions"
# Color Function Route (IT18218640)
@app.route("/reading")
def getReadActivities():
return get_reading_activities()
@app.route("/ru")
def abc():
response_val = funtion_one()
......@@ -34,7 +43,8 @@ def abc():
# return make_response(d, 200)
return response_val
if __name__ == "__main__":
app.run(host='192.168.8.101')
#app.run(host='192.168.8.100,port='5000', debug=True)
# app.run(debug=True)
\ No newline at end of file
# app.run(host='192.168.8.101')
# app.run(host='192.168.8.100,port='5000', debug=True)
app.run(debug=True)
......@@ -12,16 +12,17 @@ def create_con():
database="helply",
host="127.0.0.1",
user="root",
password="rp19970520"
password="12345678"
)
return db
def create_con_pandas():
db_connection_str = 'mysql+mysqlconnector://root:rp19970520@127.0.0.1/helply'
db_connection_str = 'mysql+mysqlconnector://root:12345678@127.0.0.1/helply'
db = create_engine(db_connection_str)
return db
def get_all_data(query):
data_dic = []
db = create_con()
......@@ -30,7 +31,7 @@ def get_all_data(query):
result = cursor.fetchall()
for row in result:
ob={
ob = {
"idcolorActivities": row[0],
"name": row[1],
"file": row[2],
......@@ -43,6 +44,27 @@ def get_all_data(query):
return jsonify(data_dic)
def get_reading_data(query):
db = create_con()
cursor = db.cursor()
cursor.execute(query)
result = cursor.fetchall()
#
# for row in result:
# ob = {
# "idcolorActivities": row[0],
# "name": row[1],
# "file": row[2],
# "des": row[3],
# "color": row[4],
# }
#
# data_dic.append(ob)
return result
def insert_data_pandas_df(pd_df, table_name):
db = create_con_pandas()
pd_df.to_sql(name=table_name, con=db, if_exists='append', index=False)
......@@ -69,7 +91,7 @@ def getDatas(query):
cursor.execute(query)
result = cursor.fetchall()
#idcolorActivities, name, image
# idcolorActivities, name, image
for row in result:
data_dic.add(row[0], ({"idcolorActivities": row[0], "name": row[1], "image": row[2]}))
......
from API.db.dbConnection import get_data
from API.db.dbConnection import get_reading_data
from flask import jsonify
def get_color_activities():
qry = 'SELECT * FROM readactivities'
def get_reading_activities():
data_dic = []
qry = 'SELECT * FROM reading'
response = get_data(qry)
result = get_reading_data(qry)
return response
\ No newline at end of file
for row in result:
ob = {
"id": row[0],
"round": row[1],
}
data_dic.append(ob)
return jsonify(data_dic)
This diff is collapsed.
......@@ -17,6 +17,7 @@
"native-base": "^3.2.2",
"react": "17.0.2",
"react-native": "0.66.2",
"react-native-elements": "^3.4.2",
"react-native-fontawesome": "^7.0.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-orientation-locker": "^1.4.0",
......
......@@ -10,6 +10,7 @@ import Splash from '../screen/splash/Splash';
import Color from '../screen/Color';
import Blue from '../screen/Blue';
import Read from '../screen/Read';
import ReadActivity from '../screen/activity/readActivity';
const Stack = createNativeStackNavigator();
const AppRouter = () => {
......@@ -56,6 +57,11 @@ const AppRouter = () => {
name="Read"
component={Read}
/>
<Stack.Screen
options={{headerShown: false}}
name="ReadActivity"
component={ReadActivity}
/>
</Stack.Navigator>
</NavigationContainer>
);
......
......@@ -20,14 +20,25 @@ import ImageButton from '../component/ImageButton';
import ButtonView from '../component/buttonView';
// const {width,height} = Dimensions.get('screen');
const webUrel = 'http://192.168.8.101:5000/ru';
const webUrel = 'http://127.0.0.1:5000/reading';
export default function Read() {
const [names, setNames] = useState([]);
const [activity, setActivity] = useState([]);
const navigation = useNavigation();
function getColorActivities() {
axios
.get(webUrel)
.then(response => {
setActivity(response.data);
console.log('response.data');
})
.catch(err => {});
}
React.useEffect(() => {
getColorActivities();
const unsubscribe = navigation.addListener('focus', () => {
// The screen is focused
// Call any action
......@@ -52,6 +63,10 @@ export default function Read() {
</View>
</View>
{/* {activity.map((data, index) => {
return <ButtonView title={data.round} color="#00008B" />;
})} */}
<ButtonView title="First Round" color="#00008B"></ButtonView>
<ButtonView title="Second Round" color="#00008B"></ButtonView>
<ButtonView title="Third Round" color="#00008B"></ButtonView>
......
......@@ -35,7 +35,7 @@ export default function ReadActivity() {
source={require('../../assets/read/background2.jpeg')}>
<View>
<View style={styles.textBody}>
<Text style={styles.text}>Say the name of this color?</Text>
<Text style={styles.text}>Pronounce this Word!</Text>
</View>
<Image
......@@ -93,7 +93,7 @@ const styles = StyleSheet.create({
textBody: {
marginTop: 150,
marginLeft: 95,
backgroundColor: '#1DCE92',
backgroundColor: '#00008B',
width: 200,
borderRadius: 50,
padding: 5,
......
......@@ -10,57 +10,54 @@ export default function Home({ navigation }){
return (
<SafeAreaView>
<ScrollView>
<View style={styles.imageContainer}>
<View style={styles.imageView}>
<Image
style={styles.image}
source={require('../assets/color/background.png')}
resizeMode="contain"></Image>
<ImageButton path="Color" title="Color Activity" />
<ScrollView>
<View style={styles.imageContainer}>
<View style={styles.imageView}>
<Image
style={styles.image}
source={require('../assets/color/background.png')}
resizeMode="contain"></Image>
<ImageButton path="Color" title="Color Activity" />
</View>
<View style={styles.imageView}>
<Image
style={styles.image}
source={require('../assets/read/background4.jpg')}
resizeMode="contain"></Image>
<ImageButton path="Read" title="Read Activity" />
</View>
</View>
<View style={styles.imageView}>
<Image
style={styles.image}
source={require('../assets/color/background.png')}
resizeMode="contain"></Image>
<ImageButton path="Read" title="Read Activity" />
<View style={styles.imageContainer}>
<View style={styles.imageView}>
<Image
style={styles.image}
source={require('../assets/color/background.png')}
resizeMode="contain"></Image>
<ImageButton path="Progress" title="Progress Chack" />
</View>
</View>
</View>
<View style={styles.imageContainer}>
<View style={styles.imageView}>
<Image
style={styles.image}
source={require('../assets/color/background.png')}
resizeMode="contain"></Image>
<ImageButton path="Progress" title="Progress Chack" />
</View>
</View>
</ScrollView>
</SafeAreaView>
</ScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
imageContainer:{
flexDirection: "row",
marginTop: 70,
},
imageView: {
width: 180,
height: 300,
// borderWidth:1,
// borderColor: "#000",
marginHorizontal: 15,
borderRadius: 50
},
image: {
width: "100%",
height: "100%",
borderRadius: 50
},
})
\ No newline at end of file
imageContainer: {
flexDirection: 'row',
marginTop: 70,
},
imageView: {
width: 180,
height: 300,
// borderWidth:1,
// borderColor: "#000",
marginHorizontal: 15,
borderRadius: 50,
},
image: {
width: '100%',
height: '100%',
borderRadius: 50,
},
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment