diff --git a/client_side/interface/UserData/denunciation_map.html b/client_side/interface/UserData/denunciation_map.html index 34a6dac..37eb798 100644 --- a/client_side/interface/UserData/denunciation_map.html +++ b/client_side/interface/UserData/denunciation_map.html @@ -18,6 +18,7 @@ +
+ + + +
+ + \ No newline at end of file diff --git a/client_side/interface/UserData/voting_results.html b/client_side/interface/UserData/voting_results.html new file mode 100644 index 0000000..f06fa6c --- /dev/null +++ b/client_side/interface/UserData/voting_results.html @@ -0,0 +1,76 @@ + + + + + Voting Results + + + + +
+ +
+
+ + + diff --git a/server_side/api/modules/databases/votings.json b/server_side/api/modules/databases/votings.json index b693596..2a96d57 100644 --- a/server_side/api/modules/databases/votings.json +++ b/server_side/api/modules/databases/votings.json @@ -37,7 +37,7 @@ "2": { "name": "Yi\u011fit \u00c7olako\u011flu Park\u0131", "desc": "Mahallemizin say\u0131n destek\u00e7isinin ad\u0131", - "votes": 0 + "votes": 2 } } } diff --git a/server_side/api/modules/rating_system.py b/server_side/api/modules/rating_system.py index b7efc65..a441c6b 100644 --- a/server_side/api/modules/rating_system.py +++ b/server_side/api/modules/rating_system.py @@ -20,6 +20,17 @@ with open(user_db, 'r') as f: class Ratings(Resource): + def get(self): + return [ + { + 'id' : v['id'], + 'name': v['name'], + 'desc': v['desc'], + 'img' : v['img'] + } + for v in ratings + ] + def post(self): """ Example POST Data: @@ -74,9 +85,7 @@ class Ratings(Resource): class Rating(Resource): def get(self, rating_id): try: - rating = copy.deepcopy(ratings[rating_id - 1]) - del rating['rates'] - return rating + return ratings[rating_id - 1] except: abort(404, error="Rating {} doesn't exist".format(rating_id)) @@ -96,7 +105,7 @@ class Rate(Resource): if 0 >= score >= 10: abort(500, 'Score should be between 0 and 10') note = request.form.get('note') - ratings[rating_id - 1]['rates'][rater_id] = { + ratings[rating_id - 1]['rates'][request.form['rater_id']] = { 'id': len(ratings[rating_id - 1]['rates']) + 1, 'rater': request.form['rater_id'], 'score': score, diff --git a/server_side/api/modules/voting_system.py b/server_side/api/modules/voting_system.py index 842ee30..bc4d4aa 100644 --- a/server_side/api/modules/voting_system.py +++ b/server_side/api/modules/voting_system.py @@ -77,8 +77,6 @@ class Voting(Resource): def get(self, voting_id): try: voting = copy.deepcopy(votings[voting_id - 1]) - for i in range(len(voting['votes'])): - del voting['votes'][str(i + 1)]['votes'] del voting['voters'] return voting