diff --git a/app/static/js/word_operation.js b/app/static/js/word_operation.js index dcf38ff..944f0e8 100644 --- a/app/static/js/word_operation.js +++ b/app/static/js/word_operation.js @@ -95,13 +95,12 @@ function parseWord(element) { function wordTemplate(word) { // 这个模板应当与 templates/userpage_get.html 中的

...

保持一致 return `

- ${word.word} - ( ${word.freq} ) - 熟悉 - 不熟悉 - 删除 - 朗读 + + + ${word.word} + (${word.freq} ) +

`; } diff --git a/app/static/pic/laba.png b/app/static/pic/laba.png new file mode 100644 index 0000000..6628bb3 Binary files /dev/null and b/app/static/pic/laba.png differ diff --git a/app/static/wordfreqapp.db b/app/static/wordfreqapp.db new file mode 100644 index 0000000..8b60cb9 Binary files /dev/null and b/app/static/wordfreqapp.db differ diff --git a/app/templates/mainpage_get.html b/app/templates/mainpage_get.html index 2a9b8e3..9da9aa2 100644 --- a/app/templates/mainpage_get.html +++ b/app/templates/mainpage_get.html @@ -44,7 +44,9 @@ {{x[0]}} {{x[1]}} {% endfor %} {% endif %} +

Version: 20240618

+ {{ yml['footer'] | safe }} diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index e5c8d95..6fab7a5 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -153,13 +153,12 @@ {% if session.get('thisWord') == x[0] and session.get('time') == 1 %} {% endif %}

+ + {{ word }} + role="button">{{ word }} ( {{ freq }} ) - 熟悉 - 不熟悉 - 删除 - 朗读 +

{% endfor %} diff --git a/app/test/test_next_article.py b/app/test/test_next_article.py new file mode 100644 index 0000000..3e470de --- /dev/null +++ b/app/test/test_next_article.py @@ -0,0 +1,85 @@ +''' Contributed by Lin Junhong et al. 2023-06.''' + +from selenium import webdriver +from selenium.webdriver.common.desired_capabilities import DesiredCapabilities + +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +from selenium.common.exceptions import UnexpectedAlertPresentException, NoAlertPresentException +import random, time +import string + +# 初始化webdriver +# driver = webdriver.Remote('http://localhost:4444/wd/hub', DesiredCapabilities.CHROME) +# driver.implicitly_wait(10) +driver = webdriver.Chrome("C:\\Users\\12993\AppData\Local\Programs\Python\Python38\\chromedriver.exe") + + +def test_next_article(): + try: + driver.get("http://118.25.96.118:90") + assert 'English Pal -' in driver.page_source + # login + elem = driver.find_element_by_link_text('登录') + elem.click() + + uname = 'abcdefg' + password = 'abcdefg' + elem = driver.find_element_by_id('username') + elem.send_keys(uname) + + elem = driver.find_element_by_id('password') + elem.send_keys(password) + elem = driver.find_element_by_xpath('/html/body/div/button') # 找到登录按钮 + elem.click() + + time.sleep(0.5) + assert 'EnglishPal Study Room for ' + uname in driver.title + for i in range(50): + time.sleep(0.1) + # 找到固定按钮 + elem = driver.find_element_by_xpath('//*[@id="load_next_article"]') + elem.click() + except Exception as e: + print(e) + + +def test_local_next_article(): + try: + driver.get("http://127.0.0.1:5000") + assert 'English Pal -' in driver.page_source + # login + elem = driver.find_element_by_link_text('注册') + elem.click() + + uname = 'abcdefg' + password = 'abcdefg' + elem = driver.find_element_by_id('username') + elem.send_keys(uname) + + elem = driver.find_element_by_id('password') + elem.send_keys(password) + + elem = driver.find_element_by_id('password2') + elem.send_keys(password) + + time.sleep(0.5) + + elem = driver.find_element_by_class_name('btn') # 找到提交按钮 + elem.click() + time.sleep(0.5) + try: + WebDriverWait(driver, 1).until(EC.alert_is_present()) + driver.switch_to.alert.accept() + except (UnexpectedAlertPresentException, NoAlertPresentException): + pass + + time.sleep(0.5) + assert 'EnglishPal Study Room for ' + uname in driver.title + for i in range(50): + time.sleep(0.1) + # 找到固定按钮 + elem = driver.find_element_by_xpath('//*[@id="load_next_article"]') + elem.click() + except Exception as e: + print(e) diff --git a/da b/da new file mode 100644 index 0000000..0ff8001 --- /dev/null +++ b/da @@ -0,0 +1,391 @@ +commit 8cbc7c9a0ce543db48f80a743c4168ca847ca500 (HEAD -> Alpha-snapshot20240618, origin/master, origin/HEAD, master) +Author: lisinan <1299311192@qq.com> +Date: Fri May 24 22:00:08 2024 +0800 + + 修复快速点击下一页按钮点击频率过快时页面跳转到未知名页面 + +commit ff6286cf01bccdda793ec626c66594e43d81cb16 (origin/547, origin/542) +Author: 丁晟晔 <759539128@qq.com> +Date: Mon May 6 11:42:32 2024 +0800 + + 删除 app/test/test_bug551_DingZeYu.py + +commit 1d7e61d7519342396bec9c64cdd8090c1515cec7 +Author: 丁晟晔 <759539128@qq.com> +Date: Mon May 6 11:36:36 2024 +0800 + + 上传文件至 app/test + +commit 708a6a282102c2b60e3abfade633389bc1f03ddb (origin/Bosh) +Merge: 43c719b 688a198 +Author: 顾涵 <1554137355@qq.com> +Date: Sun Jun 4 12:39:34 2023 +0800 + + Merge pull request 'WIP:Bug529-GuHan' (#88) from Bug529-GuHan into master + + Reviewed-on: http://121.4.94.30:3000/mrlan/EnglishPal/pulls/88 + +commit 688a19876823e818f3f312f865f4921f28f28c53 (origin/Bug529-GuHan) +Merge: 030b897 1543b30 +Author: ghaa0920 <1554137355@qq.com> +Date: Sun May 28 16:31:12 2023 +0800 + + 已经与Alpha-snapshot20230525 分支同步,重新提交 + +commit 1543b3095dde2a295293af1ea7e495d6ba005f8d (origin/Refactor-XunYucan, origin/Alpha-snapshot20230525) +Merge: c6bf323 b41e104 +Author: Xunflash +Date: Thu May 25 22:30:06 2023 +0800 + + Merge remote-tracking branch 'origin/Alpha-snapshot20230519' into Refactor-XunYucan + +commit c6bf323c6084255abcde0c47ae1a0504bd372475 +Author: Xunflash +Date: Thu May 25 21:23:25 2023 +0800 + + 修改格式 + +commit 03ccb3527a94a3c463b4bffe24ba0f579f286d5f +Author: Xunflash +Date: Thu May 25 17:35:31 2023 +0800 + + 重构前端阅读js,新增阅读器全局对象,新增生词朗读按钮 + +commit b41e1044bce3e4d9169b7743ce9aad74c0fec7d7 (origin/Alpha-snapshot20230519) +Author: Hui Lan +Date: Wed May 24 10:12:44 2023 +0800 + + difficulty.py: add some stop words, hoping that getting the next article can be faster. + +commit 67e921ba60df76640005fa2838d80808b311bc2d +Author: Hui Lan +Date: Tue May 23 22:25:40 2023 +0800 + + difficulty.py: todo. + +commit a5c3564f15cea5ddb5f79ba15bf888a332698440 +Author: Hui Lan +Date: Tue May 23 22:22:57 2023 +0800 + + difficulty.py: do not stem a word twice. + +commit 1295616d5be485475b06e456458a3b8b7a092a50 +Merge: 3494881 c151a0e +Author: Hui Lan +Date: Tue May 23 19:50:30 2023 +0800 + + Merge branch 'Bug476-YuHuangtao' of http://121.4.94.30:3000/mrlan/EnglishPal into Alpha-snapshot20230519 + +commit c151a0efaa109aa806c40105cb86d1b3950458ea (origin/Bug476-YuHuangtao) +Author: PlutoCtx +Date: Tue May 23 19:40:33 2023 +0800 + + 去掉了get_difficulty_level_for_user的多出的break + +commit 030b89706e51a35d95eb6eafa7ae2b2fefac821b +Author: ghaa0920 <1554137355@qq.com> +Date: Sat May 20 15:29:12 2023 +0800 + + special_characters = '\_©~<=>+/[]*&$%^@.,?!:;#()"“”—‘’{}|' 用于过滤字符,我将其中的“-”删去,使连字符没有被过滤,实现录入例如fifty-six等组合词的功能。另外对于删除过滤是否会引发字符bug,答案是肯定的,但是这段代码中的过滤字符虽然多,但是并没有完全过滤掉所有字符,(过滤的只是键盘上能打出的字符,不包括输入法中能打出的特殊字符),所以字符bug本身就一直存在,我认为减少一个“-”字符对程序的过滤过程不会造成问题。 + +commit 349488167b3c1cbdf6116adff5798cf356d94af2 +Author: Hui Lan +Date: Fri May 19 09:03:20 2023 +0800 + + requirements.txt: install snowballstemmer for better computing a word's difficulty level. + +commit 39d96014d90892faf22b0830ad8d78aeaaa66d96 +Author: PlutoCtx +Date: Thu May 18 23:29:38 2023 +0800 + + pull最新的snapshot-20230511,后更新了difficulty.py和Article.py的部分代码,提交了新的pickle文件 + +commit acd8db6e3e1c498650f2e8cc3021828e6132e823 +Author: ghaa0920 <1554137355@qq.com> +Date: Mon May 15 19:24:43 2023 +0800 + + special_characters = '\_©~<=>+/[]*&$%^@.,?!:;#()"“”—‘’{}|' 用于过滤字符,我将其中的“-”删去,使连字符没有被过滤,实现录入例如fifty-six等组合词的功能。另外对于删除过滤是否会引发字符bug,答案是肯定的,但是这段代码中的过滤字符虽然多,但是并没有完全过滤掉所有字符,(过滤的只是键盘上能打出的字符,不包括输入法中能打出的特殊字符),所以字符bug本身就一直存在,我认为减少一个对“1-”字符的过滤不会造成问题。 + +commit 9f3f5b43e1bc79e884091593b9b8f3d6a2164ea5 +Author: ghaa0920 <1554137355@qq.com> +Date: Mon May 15 19:15:30 2023 +0800 + + special_characters = '\_©~<=>+/[]*&$%^@.,?!:;#()"“”—‘’{}|' 用于过滤字符,我将其中的“-”删去,使连字符没有被过滤,实现录入例如fifty-six等组合词的功能。另外对于删除过滤是否会引发字符bug,答案是肯定的,但是这段代码中的过滤字符虽然多,但是并没有完全过滤掉所有字符,(过滤的只是键盘上能打出的字符,不包括输入法中能打出的特殊字符),所以字符bug本身就一直存在,我认为减少一个对“-”字符的过滤不会造成问题。 + +commit d9f6df7fbe585395a19b9a08c411d841b6b89fd4 (origin/Bug532-HuangDan) +Author: huangdan <2741654266@qq.com> +Date: Thu May 11 15:51:10 2023 +0800 + + AJAX载入文章数据 + +commit 5039f5710e4575ecbd9c5bfcc2e349dbe6025bfa (origin/Alpha-snapshot20230507) +Author: huangdan <2741654266@qq.com> +Date: Mon May 8 14:33:48 2023 +0800 + + AJAX载入文章数据 + +commit becef7e3436c93561ba581cff9b9ca9da118c888 (origin/Alpha-snapshot20230506) +Merge: a4cc4fd 01ecc83 +Author: Hui Lan +Date: Sun May 7 15:59:35 2023 +0800 + + Merge branch 'Bug502-YuGaoXiang' of http://121.4.94.30:3000/mrlan/EnglishPal into Alpha-snapshot20230506 + +commit 01ecc8376893404cb026e34e7f8fecbefcd082cf (origin/Bug502-YuGaoXiang) +Author: Awoodwhale +Date: Sat May 6 17:42:04 2023 +0800 + + refactor: refactor the way to check article level + +commit f64d06fbbf00255fc21f141d852d8995e588785e +Author: Awoodwhale +Date: Sat May 6 17:24:51 2023 +0800 + + fix: fix Bug 531 and use ES6 grammar + +commit a4cc4fd011317f3daec2de456b95abca16841663 +Merge: 779dafe 18ca48b +Author: Hui Lan +Date: Sat May 6 17:16:08 2023 +0800 + + Merge branch 'Bug522-HuangZirui' of http://121.4.94.30:3000/mrlan/EnglishPal into Alpha-snapshot20230506 + +commit 18ca48b42214720f411937b01c20550a5f96580b +Merge: a80b062 ce2e1f2 +Author: ZhuZhihao <1287365321@qq.com> +Date: Fri May 5 17:21:49 2023 +0800 + + Merge branch 'Bug522-HuangZirui' of http://121.4.94.30:3000/mrlan/EnglishPal into Bug522-HuangZirui + +commit a80b062b8707fb6a73554b8500b8c5ae17775ed3 +Author: ZhuZhihao <1287365321@qq.com> +Date: Fri May 5 17:20:58 2023 +0800 + + refactor: remove variable 'count' + +commit 779dafefe8a3ae5c40b3376d2b0309c0ddcd3273 (origin/Alpha-snapshot20230427) +Merge: e118d92 d30a434 +Author: Hui Lan +Date: Thu Apr 27 07:21:15 2023 +0800 + + Merge branch 'Bug509-XieQiuHan-WangZiming' of http://121.4.94.30:3000/mrlan/EnglishPal into Alpha-snapshot20230427 + +commit e118d92659911db4f3bd047a67865522c8b00c66 +Merge: ce2e1f2 5654fbf +Author: Hui Lan +Date: Thu Apr 27 07:20:21 2023 +0800 + + Merge branch 'Alpha-snapshot20230425' of http://121.4.94.30:3000/mrlan/EnglishPal into Alpha-snapshot20230427 + +commit 5654fbf9bc3ae85eec621a4e6e2ecd1f6c6c3b30 (origin/Alpha-snapshot20230425) +Author: 一问三不知 <178428409@qq.com> +Date: Wed Apr 26 18:49:59 2023 +0800 + + 修改:使用新的//userpage路由 + +commit d30a434b2a0dce5247bb005c5c245529d5a542d4 (origin/Bug509-XieQiuHan-WangZiming) +Author: 一问三不知 <178428409@qq.com> +Date: Tue Apr 25 17:47:51 2023 +0800 + + 修改变量名had_read_articles->visited_articles + +commit b88bc8f36b395f3979d4a9b37993b88b8a9eb658 +Merge: ef78679 6be035f +Author: Hui Lan +Date: Tue Apr 25 11:40:42 2023 +0800 + + Merge branch 'Bug509-XieQiuHan-WangZiming' of http://121.4.94.30:3000/mrlan/EnglishPal into Alpha-snapshot20230425 + +commit 6be035f2828286b5cd59f15ec04336b86c3cb0fa +Author: 一问三不知 <178428409@qq.com> +Date: Tue Apr 25 11:38:01 2023 +0800 + + 修复当没有找到文章或者文章读完时,直接刷新页面或者session不关闭重新进入页面,导致的错误; + +commit ef786795e27287502b5388e2e80aa83eac596c8d +Merge: 21a77ef fc3e274 +Author: Hui Lan +Date: Tue Apr 25 08:47:22 2023 +0800 + + Resolve merge conflict + +commit 21a77ef2df5111ca4fb0103624ee0b68a15b2a06 +Merge: 58d7349 f3d609c +Author: Hui Lan +Date: Tue Apr 25 08:42:18 2023 +0800 + + Merge branch 'Alpha' of http://121.4.94.30:3000/mrlan/EnglishPal into Alpha + +commit 58d7349afe69c5934754cb7a5145b33382326c37 +Author: Hui Lan +Date: Tue Apr 25 08:40:26 2023 +0800 + + Change from bug359-zhangkeli + +commit fc3e27488b3b55c1013a970e6abb95b88caff9aa +Author: 一问三不知 <178428409@qq.com> +Date: Fri Apr 21 05:33:26 2023 +0800 + + 给标签添加id,方便测试 + +commit 03145b57d98c29ae04948281e8e4e67512e75829 +Author: 一问三不知 <178428409@qq.com> +Date: Fri Apr 21 02:36:51 2023 +0800 + + 修复边界值问题(当刚开始就没有找到文章或者就根本被没有文章的时候,会出现上一篇按钮) + +commit 70917df47b91f7fbb16870b15f2a2ecdbdad6135 +Author: 一问三不知 <178428409@qq.com> +Date: Thu Apr 20 23:15:12 2023 +0800 + + 删除测试代码 + +commit 8f132ed87bfc00e321214dd4a4d6ed2a3ff4a8cd +Author: 一问三不知 <178428409@qq.com> +Date: Thu Apr 20 22:53:30 2023 +0800 + + 添加了阅读完所有文章的提示 + +commit da13e5bbd5da2a1ceb838c5a4836a0cabd8bdf69 +Author: 一问三不知 <178428409@qq.com> +Date: Thu Apr 20 21:28:29 2023 +0800 + + 修复Bug(没找到文章后立即上一篇会回到上上篇文章) & 标签添加id方便测试 + +commit 84affaeb69fdecb155cdf4daa4f57c4b29dbea55 +Author: 一问三不知 <178428409@qq.com> +Date: Thu Apr 20 20:30:14 2023 +0800 + + 修改 / 路由存在的问题(每次调用别的路由他都会被调用),新路由为 //userpage;同时因为修改了路由导致访问userpage_get的时候会导致静态文件路径生成错误,这里修改了\static\config.yml中的静态资源路径,修改后也都可以正常访问到的 + +commit 16de0a7fd99a26d331e23eac7c1fd22594b7c50f +Author: 一问三不知 <178428409@qq.com> +Date: Thu Apr 20 15:40:11 2023 +0800 + + 修改变量命名:existing_articles → had_read_articles + +commit ce2e1f2978e68aac46a03e0d7bc5e27b78a1106a (origin/Alpha-snapshot20230426) +Merge: 11ae093 cc8ca47 +Author: zzhaofisher <10839192+zzhaofisher@user.noreply.gitee.com> +Date: Tue Apr 18 21:52:28 2023 +0800 + + Merge branch 'DevLocal' into Bug522-HuangZirui + +commit 11ae093fd7b714b37bd26f42ad9f5b042ae1dfc1 +Merge: 3bce450 f3d609c +Author: zzhaofisher <10839192+zzhaofisher@user.noreply.gitee.com> +Date: Tue Apr 18 21:52:01 2023 +0800 + + Merge branch 'Alpha' into Bug522-HuangZirui + +commit cc8ca47f8c96eedaf2ce7ec61f5480123663953f +Author: zzhaofisher <10839192+zzhaofisher@user.noreply.gitee.com> +Date: Tue Apr 18 21:50:54 2023 +0800 + + refactor: remove sql sentences + +commit 5d20e92061d3c43dab01e0ca9483779fc9b9a9a2 +Merge: f3d609c 3bce450 +Author: zzhaofisher <10839192+zzhaofisher@user.noreply.gitee.com> +Date: Tue Apr 18 21:50:18 2023 +0800 + + Merge branch 'Bug522-HuangZirui' of http://121.4.94.30:3000/mrlan/EnglishPal into DevLocal + +commit f3d609c92bfd27ed4ef70cab838a7d1362a5fb6b (origin/Alpha) +Merge: 688ed72 15bb925 +Author: Lan Hui <1348141770@qq.com> +Date: Fri Apr 7 06:41:49 2023 +0800 + + Merge Wang Ziming's work and Wu Yuhan's work. + +commit 15bb9250248aa6feb249be72c53d3fa6d7005d52 +Author: 一问三不知 <178428409@qq.com> +Date: Tue Apr 4 22:31:53 2023 +0800 + + 将记录阅读过文章的数据结果改为字典,以及修改了flag的问题 + +commit 688ed724734fddb4a07e9dd0dc5b6b2ace16e645 +Author: Lan Hui <1348141770@qq.com> +Date: Sat Apr 1 16:07:59 2023 +0800 + + Correct grammar。 + +commit 1f150fc847d0fc70947261ff45843ccc116117c2 +Author: Awoodwhale +Date: Fri Mar 31 13:39:28 2023 +0800 + + refactor: use ajax to get expiry_date + +commit 7107f634c2ec9fa12dd6bcbed9f4ee5c339928c7 +Merge: 6f1dd13 4417cf7 +Author: 一问三不知 <178428409@qq.com> +Date: Fri Mar 31 04:58:21 2023 +0800 + + Merge branch 'test' into dev-fixBug509-reconstruction + +commit 6f1dd134193cb3f9fa1d3502b286d3be1f22c1ed +Author: 一问三不知 <178428409@qq.com> +Date: Fri Mar 31 04:50:41 2023 +0800 + + 测试的print忘删了 + +commit 4417cf7017d50f20d99e1a274b48ad5d3b32e8e6 +Author: Hui Lan +Date: Thu Mar 30 16:10:22 2023 +0800 + + Article.py: remove debug statement. + +commit 0c16a4dc6f21849915cdad92c7189e37ccb9a289 +Author: 一问三不知 <178428409@qq.com> +Date: Wed Mar 29 20:53:38 2023 +0800 + + 判断文章是否已经出现的语句写错位置了,改正下 + +commit 5b2f5199a82be7cdb7bb3ac57f7b54b5ea0f4034 +Author: 一问三不知 <178428409@qq.com> +Date: Mon Mar 27 14:28:54 2023 +0800 + + 1. 取消userpage_get.html中提示删除单词信息的代码 和 取消user_service.userpage中render_template的flashed_messages参数。因为删除单词操作已经是异步了,而提示信息的出现是同步执行,所以就注释了代码且没有产生太大影响。 + 2. 修改取消user_service.deleteword中对注释flash代码的注释,根据上一步进行了重新解释。 + +commit 0ce1c6eb6e5707ccfb47113b2c58c9961f2eae48 +Author: Lan Hui <1348141770@qq.com> +Date: Sun Mar 26 21:14:29 2023 +0800 + + 文章管理页面:每篇文章中保留换行,方便查看。 + +commit d4ac7093859d400f77f24c7cf5b6d39dd67b2e9a +Author: Lan Hui <1348141770@qq.com> +Date: Sun Mar 26 21:05:05 2023 +0800 + + 将删除按钮移到第一行,避免因为文章的标题过长跨行导致删除按钮形状改变。 + +commit 9eb5210d3f11211abe756597518d09b1cfd8f3e4 +Author: Lan Hui <1348141770@qq.com> +Date: Sun Mar 26 20:58:37 2023 +0800 + + Level与Date的冒号后面加个空格,使得后面的信息更加看得清楚。 + +commit 0e257373816ee365d41e78b0b13ba807e0230aac +Author: Lan Hui <1348141770@qq.com> +Date: Sun Mar 26 20:56:08 2023 +0800 + + 管理文章页面的文章列表中,每篇文章不再在内容部分重新显示标题。 + +commit b3b154a24f9bb267146712e6020903a6e574c976 +Author: Lan Hui <1348141770@qq.com> +Date: Sun Mar 26 19:06:04 2023 +0800 + + 简化管理文章与管理用户页面信息。 + +commit 4d99405bfaf2f87abdf4bfa1291083419c6df502 +Author: Lan Hui <1348141770@qq.com> +Date: Sun Mar 26 18:59:15 2023 +0800 + + 简化管理员页面信息。删除退出登录按钮,可以返回到前一页后再退出,不影响使用体验。删除'管理员您好'欢迎词,没啥意义。 + +commit 8d8b9197b614b595bbba1ecf95c189ea1389780c +Author: Lan Hui <1348141770@qq.com> +Date: Sun Mar 26 09:59:06 2023 +0800 + + 手动输入的文字最高难度等级是4 diff --git a/img.png b/img.png new file mode 100644 index 0000000..216ea36 Binary files /dev/null and b/img.png differ