Commit 0c2ad31a0d48c7be6be5c9afcac18c4fc590834b
1 parent
5d043355e3
Exists in
master
[#003]
Showing
1 changed file
with
15 additions
and
23 deletions
Show diff stats
imports/collections/students/serverCsvUpload.js
... | ... | @@ -55,12 +55,12 @@ export const addStudentCSV= new ValidatedMethod({ |
55 | 55 | data = item ; |
56 | 56 | console.log("data"); |
57 | 57 | console.log(data); |
58 | - return true; | |
58 | + // return true; | |
59 | 59 | const user = Users.findOne({_id: this.userId}); |
60 | 60 | orgId = user.orgId; |
61 | 61 | newStudentId = Users.insert({ |
62 | 62 | // emails: [{address:data.email, verified: false}], |
63 | - username: data["First Name*"], | |
63 | + //username: data["First Name*"], | |
64 | 64 | firstName: data["First Name*"], |
65 | 65 | lastName: data['Last Name*'], |
66 | 66 | orgId: orgId, |
... | ... | @@ -68,8 +68,8 @@ export const addStudentCSV= new ValidatedMethod({ |
68 | 68 | }); |
69 | 69 | newParentUserId = Users.insert({ |
70 | 70 | //emails: [{address:data.parentEmail, verified: false}], |
71 | - username: data.parentName, | |
72 | - firstName: data.parentName, | |
71 | + //username: data['Parent Name*'], | |
72 | + firstName: data['Parent Name*'], | |
73 | 73 | orgId: orgId, |
74 | 74 | role: 'PARENT' |
75 | 75 | }); |
... | ... | @@ -77,14 +77,6 @@ export const addStudentCSV= new ValidatedMethod({ |
77 | 77 | newParentId = Parents.insert({ |
78 | 78 | userId: newParentUserId, |
79 | 79 | orgId: orgId, |
80 | - address: data.address, | |
81 | - gender: data.gender, | |
82 | - dob: data.dob, | |
83 | - rollNo: data.rollNo, | |
84 | - class: data.studentclass, | |
85 | - section: data.section, | |
86 | - bloodGroup: data.bloodGroup, | |
87 | - community: data.community, | |
88 | 80 | }); |
89 | 81 | console.log("newParentUserId"); |
90 | 82 | console.log(newParentUserId); |
... | ... | @@ -95,16 +87,16 @@ export const addStudentCSV= new ValidatedMethod({ |
95 | 87 | Students.insert({ |
96 | 88 | userId: newStudentId, |
97 | 89 | orgId: orgId, |
98 | - admissionId: data['Student Admission ID*'], | |
99 | - address: data['Student Admission ID*'], | |
100 | - gender: data['Gender(male/female)*'], | |
90 | + admissionId: data['Student Admission ID*'], | |
91 | + address: data['Student Admission ID*'], | |
92 | + gender: data['Gender(male/female)*'], | |
101 | 93 | dob: data['Birthday(YYYY-MM-DD)*'], |
102 | - rollNo: data.rollNo, | |
103 | - class: data.studentclass, | |
104 | - section: data.section, | |
105 | - bloodGroup: data.bloodGroup, | |
106 | - community: data.community, | |
107 | - parent: [{id: newParentUserId, relatinship: data.relation}] | |
94 | + rollNo: data['Student Roll*'], | |
95 | + class: data['Student Class Name*'], | |
96 | + section: data['Student Section Name*'], | |
97 | + bloodGroup: data['Blood Group*'], | |
98 | + community: data['Community'], | |
99 | + parent: [{id: newParentUserId, relatinship: data['Parent Relation*']}] | |
108 | 100 | }); |
109 | 101 | } |
110 | 102 | return {newStudentId}; |
... | ... | @@ -126,13 +118,13 @@ export const studentUploadCsv = new ValidatedMethod({ |
126 | 118 | console.log(temp); |
127 | 119 | // var data_1=csv1.csvtojson(("/Users/satheeshnagaraj/Downloads/11.csv")); //csvtojson is function that accepts csv filenames and returns JSON object |
128 | 120 | //console.log(data);'' |
129 | - Stores = new Mongo.Collection('stores'); | |
121 | + // Stores = new Mongo.Collection('stores'); | |
130 | 122 | // data = data_1; |
131 | 123 | |
132 | 124 | var CSV_valid_buffer = []; |
133 | 125 | var CSV_invalid_buffer = []; |
134 | 126 | var filename = new Date().getTime().toString(); |
135 | - var csv_filepath = '/Users/satheeshnagaraj/Documents/Workspace/Meteor/ydapp/CSV_Files/'; | |
127 | + var csv_filepath = '/Users/satheeshnagaraj/Documents/Workspace/Meteor/Youngdesk/ydapp/CSV_Files/'; | |
136 | 128 | |
137 | 129 | |
138 | 130 | for (let i = 0; i < data.length; i++) | ... | ... |