klpdotorg / dubdubdub

Home of KLP. Houses *most* of the data and APIs.
MIT License
5 stars 4 forks source link

Konnect syncing fails for certain user types #736

Open ansal opened 7 years ago

ansal commented 7 years ago

When the sync data contains user (respondent) types of GO, HM and EO, the sync fails. Sample data -

{"stories":[{"synced":0,"sysid":"","group_id":18,"image":"","respondent_type":"GO","created_at":1505988827423,"school_id":1919,"_id":1,"lat":0,"user_id":1825,"lng":0,"answers":[{"text":"Yes","question_id":144,"created_at":1503906234111,"_id":41,"story_id":1},{"text":"Yes","question_id":138,"created_at":1503906234111,"_id":42,"story_id":1},{"text":"Yes","question_id":147,"created_at":1503906234111,"_id":43,"story_id":1},{"text":"Yes","question_id":270,"created_at":1503906234111,"_id":44,"story_id":1},{"text":"Yes","question_id":145,"created_at":1503906234111,"_id":45,"story_id":1},{"text":"Yes","question_id":143,"created_at":1503906234111,"_id":46,"story_id":1},{"text":"Yes","question_id":269,"created_at":1503906234111,"_id":47,"story_id":1},{"text":"Yes","question_id":148,"created_at":1503906234111,"_id":48,"story_id":1},{"text":"Yes","question_id":150,"created_at":1503906234111,"_id":49,"story_id":1},{"text":"Yes","question_id":149,"created_at":1503906234111,"_id":50,"story_id":1},{"text":"Yes","question_id":143,"created_at":1505988827423,"_id":51,"story_id":1},{"text":"Yes","question_id":269,"created_at":1505988827423,"_id":52,"story_id":1},{"text":"Yes","question_id":270,"created_at":1505988827423,"_id":53,"story_id":1},{"text":"Yes","question_id":149,"created_at":1505988827423,"_id":54,"story_id":1},{"text":"Yes","question_id":145,"created_at":1505988827423,"_id":55,"story_id":1},{"text":"Yes","question_id":148,"created_at":1505988827423,"_id":56,"story_id":1},{"text":"Yes","question_id":147,"created_at":1505988827423,"_id":57,"story_id":1},{"text":"Yes","question_id":138,"created_at":1505988827423,"_id":58,"story_id":1},{"text":"Yes","question_id":150,"created_at":1505988827423,"_id":59,"story_id":1},{"text":"Yes","question_id":144,"created_at":1505988827423,"_id":60,"story_id":1}]}]}

prajdataspect commented 7 years ago

Which api is this? Can you give the link?

prajdataspect commented 7 years ago

It'll be good to have the link /curl to test the API. However, the types GO, HM, EO are not there in the usertype table. That must be the issue. dubdubdub=> select * from stories_usertype; id | name ----+------ 1 | AS 2 | PR 3 | TR 4 | VR 5 | CM 6 | SM 7 | EY 8 | LL 9 | ER 14 | CH (10 rows)

ansal commented 7 years ago

@prajdataspect https://www.getpostman.com/collections/486f337b22b5d7333f51 contains all the Konnect API end points.

However, the types GO, HM, EO are not there in the usertype table. That must be the issue.

Can you please write a management script that creates these user types?

prajdataspect commented 7 years ago

insert into stories_usertype values (10, 'GO'); insert into stories_usertype values (11, 'HM'); insert into stories_usertype values (12, 'EO');

Did the above in dev and the test case worked successfully. Here you go:

id | user_id | school_id | group_id | is_verified | name | email | date | telephone | entered_timestamp | comments | sysid | created_at | date_of_visit | updated_at | user_type_id | location
--------+---------+-----------+----------+-------------+---------+------------------------------------+------+------------+-------------------------------+----------+-------+-------------------------------+------------------------+-------------------------------+--------------+---------------------------------------------------- 420993 | 7159 | 1919 | 18 | t | Ansal S | 9900247365.konnectdummy@klp.org.in | | 9900247365 | 2017-10-06 10:31:41.88949+00 | | | 2017-10-06 10:31:41.889407+00 | 2017-09-21 10:13:47+00 | 2017-10-06 10:31:41.909324+00 | 10 | 0101000020E610000000000000000000000000000000000000