Commit c83bb798 authored by Kedar Aitawdekar's avatar Kedar Aitawdekar 💻

Merge branch 'master' of https://github.com/gnowledge/gstudio

parents b8f3db4c d2166a29
# Data Restoration
## Pre Requisites:
- Ready with Expected Data (ED) backup-folder.
## STEP - I] Replace `data` folder
- Stop running `gstudio` server
- `docker stop gstudio`
- [Check]: If server is stopped or not.
+ `docker ps`
+ Above command should not show any entry of container - `gstudio`
- From terminal, move to expected data path
- `cd </path/where/data/is/mounted>`
- Rename existing data folder with existing school *server-id*.
+ e.g: `data` --> `data-tg32`
+ This step is optional to make provision of new backup-folder which will be renamed as `data`
+ *Note: This step will persist `N` nos of folders after period of time, check for your HDD space*
- Copy/Move ED folder here. Choose either of following
+ **Copy** (notice **`.`** at end): `rsync -avzPh <path/to/ED/backup-folder> .`
+ **Move** (notice **`.`** at end): `mv -v <path/to/ED/backup-folder> .`
- Rename copied/moved ED backup-folder to `data`:
+ **Rename**: `mv -v <name of ED backup-folder> data`
## STEP - II] Import users/`sql` data
## STEP - III] Replace settings files
## Post Restoration Checkpoints:
1. ..
2. ..
3. ..
---
## Summary:
- 2 data steps(step - I & II) and 1 configuration/settings step(step - III)
\ No newline at end of file
......@@ -283,9 +283,7 @@ class Buddy(DjangoDocument):
added_buddies_userids_list = Author.get_user_id_list_from_author_oid_list(added_removed_buddies_dict['added'])
# print "added_buddies_userids_list : ", added_buddies_userids_list
removed_buddies_userids_list = Author.get_user_id_list_from_author_oid_list(added_removed_buddies_dict['removed'])
# print "removed_buddies_userids_list : ", removed_buddies_userids_list
# DjangoActiveUsersGroup.update_user_set(
# add=added_buddies_userids_list,
......
......@@ -26,8 +26,8 @@ def list_buddy(request, group_id='home'):
fetching all buddies.
'''
buddies_authid_name_dict= request.session.get('buddies_authid_name_dict', {})
buddies_authid_list = request.session.get('buddies_authid_list', [])
buddies_authid_name_dict = request.session.get('buddies_authid_name_dict', {})
buddies_authid_list = request.session.get('buddies_authid_list', [])
# to load all user's at page load time (performance penalty, kept for ref):
#
# filter_authors = [ObjectId(auth_oid)for auth_oid in buddies_authid_list]
......@@ -60,20 +60,21 @@ def list_buddy(request, group_id='home'):
@get_execution_time
def update_buddies(request, group_id):
# list of `User` ids. i.e: [int]
selected_buddies_list = eval(request.POST.get('selected_buddies_list', '[]'))
# print "=== selected_buddies_list : ", selected_buddies_list
# Author ids: i.e: [ObjectId]
selected_buddies_userids_list = Author.get_user_id_list_from_author_oid_list(selected_buddies_list)
# ensure unique entries:
selected_buddies_userids_set = set(selected_buddies_userids_list)
updated_buddies_authid_name_dict = {}
already_active_userid_name_dict = {}
# [ObjectId]
buddies_authid_list = request.session.get('buddies_authid_list', [])
# existing buddies
existing_buddies_userid_list = Author.get_user_id_list_from_author_oid_list(buddies_authid_list)
# print "=== buddies_authid_list : ", buddies_authid_list
# print "=== existing_buddies_userid_list : ", existing_buddies_userid_list
intersection_buddy_userids = selected_buddies_userids_set.intersection(set(existing_buddies_userid_list))
# print "=======", intersection_buddy_userids
if selected_buddies_list:
......@@ -88,13 +89,8 @@ def update_buddies(request, group_id):
# { b['_id'].__str__(): b['name'] for b in updated_buddies_cur}
if auth_cur:
already_active_userid_name_dict = {a['created_by']: a['name'] for a in auth_cur}
# print "==== already_active_userid_name_dict : ", already_active_userid_name_dict
selected_buddies_list = list(selected_buddies_userids_set - sitewide_active_userids_set) + list(intersection_buddy_userids)
# print "== sitewide_active_userids_set: ", sitewide_active_userids_set
# print "selected_buddies_list : ", selected_buddies_list
# print "== selected_buddies_userids_set: ", selected_buddies_userids_set
selected_buddies_list = Author.get_author_oid_list_from_user_id_list(user_ids_list=selected_buddies_list, list_of_str_oids=True)
if selected_buddies_list or buddies_authid_list:
......@@ -102,7 +98,6 @@ def update_buddies(request, group_id):
# update_buddies method signature:
# def update_buddies(self, loggedin_userid, session_key, buddy_auth_ids_list=[]):
active_buddy_auth_list = Buddy.update_buddies(request.user.id, request.session.session_key, selected_buddies_list)
# print "\n\nactive_buddy_auth_list : ", active_buddy_auth_list
# ab: active buddy
updated_buddies_cur = node_collection.find({
......@@ -121,13 +116,11 @@ def update_buddies(request, group_id):
request.session['buddies_authid_list'] = active_buddy_auth_list
request.session['buddies_authid_name_dict'] = json.dumps(updated_buddies_authid_name_dict)
request.session['buddies_username_id_dict'] = json.dumps(buddies_username_id_dict)
# print "\n\nrequest.session['buddies_authid_name_dict'] : ", request.session['buddies_authid_name_dict']
result_dict = {
'buddies': updated_buddies_authid_name_dict,
'already_active': already_active_userid_name_dict
}
# print "=== result_dict : ", result_dict
return HttpResponse(json.dumps(result_dict))
......
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