-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlecfinder.py
270 lines (226 loc) · 10.8 KB
/
lecfinder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
import pandas as pd
class LecFinder:
def __init__(self):
self.groupid_lec1 = 강의 group_id(5자리수)
self.groupid_lec2 = 강의 group_id(5자리수)
self.lms_id = 'LMS 로그인 아이디'
self.lms_pw = 'LMS 로그인 비밀번호'
def lec1_report(self, driver):
driver.get('https://ieilms.jbnu.ac.kr/paper/paperList.jsp?group_id={}'.format(self.groupid_lec1))
# 레포트 개수
elements = driver.find_elements_by_css_selector('#borderBox > tbody > tr')
elementcount = len(elements)
if elementcount >= 1:
# 레포트 리스트
title = []
date = []
submit = []
for i in range(1, elementcount + 1):
titleresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[2]'.format(i)).text
title.append(str(titleresult))
dateresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[3]'.format(i)).text
date.append(str(dateresult))
submitresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[4]'.format(i)).text
submit.append(str(submitresult))
df = pd.DataFrame({'과제제목': title,
'제출기간': date,
'제출여부': submit})
return df
else:
return '레포트는 없습니다.'
def lec2_report(self, driver):
driver.get('https://ieilms.jbnu.ac.kr/paper/paperList.jsp?group_id={}'.format(self.groupid_lec2))
# 레포트 개수
elements = driver.find_elements_by_css_selector('#borderBox > tbody > tr')
elementcount = len(elements)
if elementcount >= 1:
# 레포트 리스트
title = []
date = []
submit = []
for i in range(1, elementcount + 1):
titleresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[2]'.format(i)).text
title.append(str(titleresult))
dateresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[3]'.format(i)).text
date.append(str(dateresult))
submitresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[4]'.format(i)).text
submit.append(str(submitresult))
df = pd.DataFrame({'과제제목': title,
'제출기간': date,
'제출여부': submit})
return df
else:
return '레포트는 없습니다.'
def lec1_video(self, driver):
driver.get(
'https://ieilms.jbnu.ac.kr/attend/videoDataViewAttendListStudent.jsp?group_id={}'.format(self.groupid_lec1))
# 비디오 개수
elements = driver.find_elements_by_css_selector('#dataBox > table > tbody > tr')
elementcount = len(elements)
if elementcount >= 1:
# 비디오 리스트
title = []
date = []
attendence = []
for i in range(1, elementcount + 1):
titleresult = driver.find_element_by_xpath('//*[@id="dataBox"]/table/tbody/tr[{}]/td[2]'.format(i)).text
title.append(str(titleresult))
dateresult = driver.find_element_by_xpath('//*[@id="dataBox"]/table/tbody/tr[{}]/td[3]'.format(i)).text
date.append(str(dateresult))
attendenceresult = driver.find_element_by_xpath(
'//*[@id="dataBox"]/table/tbody/tr[{}]/td[6]'.format(i)).text
attendence.append(str(attendenceresult))
ds = pd.DataFrame({'강의제목': title,
'인정기간': date,
'출석여부': attendence})
return ds
else:
return '강의는 없습니다.'
def lec2_video(self, driver):
driver.get('https://ieilms.jbnu.ac.kr/attend/videoDataViewAttendListStudent.jsp?group_id={}'.format(self.groupid_lec2))
# 비디오 개수
elements = driver.find_elements_by_css_selector('#dataBox > table > tbody > tr')
elementcount = len(elements)
if elementcount >= 1:
# 비디오 리스트
title = []
date = []
attendence = []
for i in range(1, elementcount + 1):
titleresult = driver.find_element_by_xpath('//*[@id="dataBox"]/table/tbody/tr[{}]/td[2]'.format(i)).text
title.append(str(titleresult))
dateresult = driver.find_element_by_xpath('//*[@id="dataBox"]/table/tbody/tr[{}]/td[3]'.format(i)).text
date.append(str(dateresult))
attendenceresult = driver.find_element_by_xpath(
'//*[@id="dataBox"]/table/tbody/tr[{}]/td[6]'.format(i)).text
attendence.append(str(attendenceresult))
ds = pd.DataFrame({'강의제목': title,
'인정기간': date,
'출석여부': attendence})
return ds
else:
return '강의는 없습니다.'
def lec1_quiz(self, driver):
driver.get('https://ieilms.jbnu.ac.kr/quiz/quizList.jsp?group_id={}'.format(self.groupid_lec1))
# 퀴즈 개수
elements = driver.find_elements_by_css_selector('#borderBox > tbody > tr')
elementcount = len(elements)
if elementcount >= 1:
# 퀴즈 리스트
title = []
date = []
submit = []
for i in range(1, elementcount + 1):
titleresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[2]'.format(i)).text
title.append(str(titleresult))
dateresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[3]'.format(i)).text
date.append(str(dateresult))
submitresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[4]'.format(i)).text
submit.append(str(submitresult))
dc = pd.DataFrame({'퀴즈제목': title,
'기간': date,
'제출여부': submit})
return dc
else:
return '퀴즈는 없습니다.'
def lec2_quiz(self, driver):
driver.get('https://ieilms.jbnu.ac.kr/quiz/quizList.jsp?group_id={}'.format(self.groupid_lec2))
# 퀴즈 개수
elements = driver.find_elements_by_css_selector('#borderBox > tbody > tr')
elementcount = len(elements)
if elementcount >= 1:
# 퀴즈 리스트
title = []
date = []
submit = []
for i in range(1, elementcount + 1):
titleresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[2]'.format(i)).text
title.append(str(titleresult))
dateresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[3]'.format(i)).text
date.append(str(dateresult))
submitresult = driver.find_element_by_xpath('//*[@id="borderBox"]/tbody/tr[{}]/td[4]'.format(i)).text
submit.append(str(submitresult))
dc = pd.DataFrame({'퀴즈제목': title,
'기간': date,
'제출여부': submit})
return dc
else:
return '퀴즈는 없습니다.'
def report1_result(self, driver):
df = self.lec1_report(driver)
if isinstance(df, str):
return '레포트는 없습니다.'
else:
count = len(df['과제제목'])
count_correct = []
for s in range(count):
if df['제출여부'][s] == '미제출':
count_correct.append(df['과제제목'][s] + df['제출기간'].str[24:29][s])
if len(count_correct) >= 1:
return count_correct
return '레포트는 없습니다.'
def report2_result(self, driver):
df = self.lec2_report(driver)
if isinstance(df, str):
return '레포트는 없습니다.'
else:
count = len(df['과제제목'])
count_correct = []
for s in range(count):
if df['제출여부'][s] == '미제출':
count_correct.append(df['과제제목'][s] + df['제출기간'].str[24:29][s])
if len(count_correct) >= 1:
return count_correct
return '레포트는 없습니다.'
def video1_result(self, driver):
ds = self.lec1_video(driver)
if isinstance(ds, str):
return '영상은 없습니다.'
else:
count = len(ds['강의제목'])
count_correct = []
for s in range(count):
if ds['출석여부'][s] == '결석':
count_correct.append((ds['강의제목'][s] + ' 강의', ds['인정기간'].str[24:29][s]))
if len(count_correct) >= 1:
return count_correct
return '영상은 없습니다.'
def video2_result(self, driver):
ds = self.lec2_video(driver)
if isinstance(ds, str):
return '영상은 없습니다.'
else:
count = len(ds['강의제목'])
count_correct = []
for s in range(count):
if ds['출석여부'][s] == '결석':
count_correct.append((ds['강의제목'][s] + ' 강의', ds['인정기간'].str[24:29][s]))
if len(count_correct) >= 1:
return count_correct
return '영상은 없습니다.'
def quiz1_result(self, driver):
dc = self.lec1_quiz(driver)
if isinstance(dc, str):
return '퀴즈는 없습니다.'
else:
count = len(dc['퀴즈제목'])
count_correct = []
for s in range(count):
if dc['제출여부'][s] == '미제출':
count_correct.append(dc['퀴즈제목'][s] + dc['기간'].str[24:29][s])
if len(count_correct) >= 1:
return count_correct
return '퀴즈는 없습니다.'
def quiz2_result(self, driver):
dc = self.lec2_quiz(driver)
if isinstance(dc, str):
return '퀴즈는 없습니다.'
else:
count = len(dc['퀴즈제목'])
count_correct = []
for s in range(count):
if dc['제출여부'][s] == '미제출':
count_correct.append(dc['퀴즈제목'][s] + dc['기간'].str[24:29][s])
if len(count_correct) >= 1:
return count_correct
return '퀴즈는 없습니다.'