Skip to content

Commit

Permalink
Merge pull request #1148 from elimu-ai/fix-#1092-StoryBook-chapter-nu…
Browse files Browse the repository at this point in the history
…mber-displayed-incorrectly

fix: #1092 StoryBook chapter number displayed incorrectly
  • Loading branch information
nya-elimu authored Dec 3, 2020
2 parents 2e5bf91 + 452b9c4 commit 9f2269e
Show file tree
Hide file tree
Showing 51 changed files with 1,242 additions and 1,039 deletions.
2 changes: 1 addition & 1 deletion src/main/java/ai/elimu/web/SignOnController.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public String handleOfflineSignOnRequest(HttpServletRequest request) {
contributor.setEmail("[email protected]");
contributor.setFirstName("Dev");
contributor.setLastName("Contributor");
contributor.setRoles(new HashSet<>(Arrays.asList(Role.ADMIN, Role.ANALYST, Role.CONTRIBUTOR)));
contributor.setRoles(new HashSet<>(Arrays.asList(Role.CONTRIBUTOR, Role.EDITOR, Role.ANALYST, Role.ADMIN)));
contributor.setRegistrationTime(Calendar.getInstance());
contributorDao.create(contributor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ public String handleSubmit(
storyBookDao.update(storyBook);

// Store the StoryBookChapters in the database
int chapterSortOrder = 0;
for (StoryBookChapter storyBookChapter : storyBookChapters) {
storyBookChapter.setStoryBook(storyBook);

Expand Down Expand Up @@ -365,6 +366,9 @@ public String handleSubmit(
continue;
}

// Update the chapter's sort order (in case any of the previous chapters were excluded)
storyBookChapter.setSortOrder(chapterSortOrder);

// Store the chapter's image (if any)
Image chapterImage = storyBookChapter.getImage();
if (chapterImage != null) {
Expand All @@ -375,6 +379,7 @@ public String handleSubmit(
// Only store the chapter if it has an image or at least one paragraph
if ((chapterImage != null) || (!storyBookParagraphsAssociatedWithChapter.isEmpty())) {
storyBookChapterDao.create(storyBookChapter);
chapterSortOrder++;
}

// Store the chapter's paragraphs in the database
Expand All @@ -391,8 +396,8 @@ public String handleSubmit(
/**
* See http://www.mkyong.com/spring-mvc/spring-mvc-failed-to-convert-property-value-in-file-upload-form/
* <p></p>
Fixes this error message:
"Cannot convert value of type [org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile] to required type [byte] for property 'ePubBytes[0]'"
* Fixes this error message:
* "Cannot convert value of type [org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile] to required type [byte] for property 'ePubBytes[0]'"
*/
@InitBinder
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws ServletException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package ai.elimu.web.content.storybook;

import ai.elimu.dao.StoryBookChapterDao;
import org.apache.logging.log4j.Logger;
import ai.elimu.dao.StoryBookDao;
import ai.elimu.model.content.StoryBook;
import ai.elimu.model.content.StoryBookChapter;
import ai.elimu.model.enums.ReadingLevel;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -18,6 +21,9 @@ public class StoryBookListController {

@Autowired
private StoryBookDao storyBookDao;

@Autowired
private StoryBookChapterDao storyBookChapterDao;

@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model) {
Expand All @@ -28,6 +34,20 @@ public String handleRequest(Model model) {
model.addAttribute("storyBooksLevel3", storyBookDao.readAllOrdered(ReadingLevel.LEVEL3));
model.addAttribute("storyBooksLevel4", storyBookDao.readAllOrdered(ReadingLevel.LEVEL4));
model.addAttribute("storyBooksUnleveled", storyBookDao.readAllUnleveled());

// Correct wrong sort order of storybook chapters
// TODO: remove this once executed
for (StoryBook storyBook : storyBookDao.readAll()) {
logger.info("Fixing chapter sortOrder for StoryBook " + storyBook.getId());
Integer sortOrder = 0;
for (StoryBookChapter storyBookChapter : storyBookChapterDao.readAll(storyBook)) {
logger.info("storyBookChapter.getId(): " + storyBookChapter.getId());
logger.info("sortOrder: " + sortOrder);
storyBookChapter.setSortOrder(sortOrder);
storyBookChapterDao.update(storyBookChapter);
sortOrder++;
}
}

return "content/storybook/list";
}
Expand Down
62 changes: 31 additions & 31 deletions src/main/resources/db/content_PROD/ben/allophones.csv
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
id,value_ipa,value_sampa,audio_id,diacritic,sound_type,usage_count
1,ɐ,6,,false,VOWEL,166
2,.,.,,false,,114
7,e,e,,false,VOWEL,77
4,m,m,,false,CONSONANT,76
6,i,i,,false,VOWEL,68
8,ʃ,S,,false,CONSONANT,48
5,t,t,,false,CONSONANT,43
9,o,o,,false,VOWEL,38
3,r,r,,false,CONSONANT,31
11,b,b,,false,CONSONANT,26
12,k,k,,false,CONSONANT,20
1,ɐ,6,,false,VOWEL,185
7,e,e,,false,VOWEL,87
4,m,m,,false,CONSONANT,81
2,.,.,,false,,72
5,t,t,,false,CONSONANT,65
6,i,i,,false,VOWEL,64
8,ʃ,S,,false,CONSONANT,61
9,o,o,,false,VOWEL,47
46,ɾ," 4",,false,CONSONANT,42
3,r,r,,false,CONSONANT,34
11,b,b,,false,CONSONANT,27
23,pʰ,p_h,,false,CONSONANT,19
14,d,d,,false,CONSONANT,18
15,kʰ,k_h,,false,CONSONANT,18
46,ɾ," 4",,false,CONSONANT,17
13,dʒ,dZ,,false,CONSONANT,16
13,dʒ,dZ,,false,CONSONANT,17
10,ɔ,O,,false,VOWEL,9
34,u,u,,false,VOWEL,7
43,ʃʰ,S_h,,false,CONSONANT,7
16,p,p,,false,CONSONANT,6
10,ɔ,O,,false,VOWEL,6
17,bʱ,b_h,,false,CONSONANT,4
18,ː,:,,false,,4
17,bʱ,b_h,,false,CONSONANT,0
19,dʒʱ,dZ_h\,,false,CONSONANT,0
20,dʱ,d_h\,,false,CONSONANT,0
30,g,g,,false,CONSONANT,0
31,h,h,,false,CONSONANT,0
21,j,j,,false,CONSONANT,0
12,k,k,,false,CONSONANT,0
32,l,l,,false,CONSONANT,0
22,n,n,,false,CONSONANT,0
16,p,p,,false,CONSONANT,0
33,s,s,,false,CONSONANT,0
24,tʰ,t_h,,false,CONSONANT,0
35,w,w,,false,CONSONANT,0
36,z,z,,false,CONSONANT,0
37,æ,{,,false,VOWEL,0
38,ŋ,N,,false,CONSONANT,0
39,ɕ,s\,,false,,0
40,ɖ,d`,,false,CONSONANT,0
25,ɖʱ,d`_h\,,false,CONSONANT,0
26,ɡʱ,g_h\,,false,CONSONANT,0
41,ɦ,h\,,false,CONSONANT,0
42,ɸ,p\,,false,,0
27,ɽ,r`,,false,CONSONANT,0
28,ɽʱ,r`_h\,,false,CONSONANT,0
44,ʈ,t`,,false,CONSONANT,0
29,ʈʰ,t`_h,,false,CONSONANT,0
30,g,g,,false,CONSONANT,-1
31,h,h,,false,CONSONANT,-1
32,l,l,,false,CONSONANT,-1
33,s,s,,false,CONSONANT,-1
35,w,w,,false,CONSONANT,-1
36,z,z,,false,CONSONANT,-1
37,æ,{,,false,VOWEL,-1
38,ŋ,N,,false,CONSONANT,-1
39,ɕ,s\,,false,,-1
40,ɖ,d`,,false,CONSONANT,-1
41,ɦ,h\,,false,CONSONANT,-1
42,ɸ,p\,,false,,-1
44,ʈ,t`,,false,CONSONANT,-1
45,β,B,,false,,-1
18,ː,:,,false,,0
45,β,B,,false,,0
37 changes: 37 additions & 0 deletions src/main/resources/db/content_PROD/ben/images.csv
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,40 @@ id,content_type,content_license,attribution_url,title,download_url,image_format
56,image/jpg,null,"null","storybook-4-ch-20","/image/56.jpg",JPG
57,image/jpg,null,"null","storybook-4-ch-21","/image/57.jpg",JPG
58,image/jpg,null,"null","storybook-4-ch-22","/image/58.jpg",JPG
59,image/jpg,null,"null","storybook-5-cover","/image/59.jpg",JPG
60,image/jpg,null,"null","storybook-5-ch-1","/image/60.jpg",JPG
61,image/jpg,null,"null","storybook-5-ch-2","/image/61.jpg",JPG
62,image/jpg,null,"null","storybook-5-ch-3","/image/62.jpg",JPG
63,image/jpg,null,"null","storybook-5-ch-4","/image/63.jpg",JPG
64,image/jpg,null,"null","storybook-5-ch-5","/image/64.jpg",JPG
65,image/jpg,null,"null","storybook-5-ch-6","/image/65.jpg",JPG
66,image/jpg,null,"null","storybook-5-ch-7","/image/66.jpg",JPG
67,image/jpg,null,"null","storybook-5-ch-8","/image/67.jpg",JPG
68,image/jpg,null,"null","storybook-5-ch-9","/image/68.jpg",JPG
69,image/jpg,null,"null","storybook-5-ch-10","/image/69.jpg",JPG
70,image/jpg,null,"null","storybook-5-ch-11","/image/70.jpg",JPG
71,image/jpg,null,"null","storybook-5-ch-12","/image/71.jpg",JPG
72,image/jpg,null,"null","storybook-6-cover","/image/72.jpg",JPG
73,image/jpg,null,"null","storybook-6-ch-1","/image/73.jpg",JPG
74,image/jpg,null,"null","storybook-6-ch-2","/image/74.jpg",JPG
75,image/jpg,null,"null","storybook-6-ch-3","/image/75.jpg",JPG
76,image/jpg,null,"null","storybook-6-ch-4","/image/76.jpg",JPG
77,image/jpg,null,"null","storybook-6-ch-5","/image/77.jpg",JPG
78,image/jpg,null,"null","storybook-6-ch-6","/image/78.jpg",JPG
79,image/jpg,null,"null","storybook-6-ch-7","/image/79.jpg",JPG
80,image/jpg,null,"null","storybook-6-ch-8","/image/80.jpg",JPG
81,image/jpg,null,"null","storybook-6-ch-9","/image/81.jpg",JPG
82,image/jpg,null,"null","storybook-6-ch-10","/image/82.jpg",JPG
83,image/jpg,null,"null","storybook-6-ch-11","/image/83.jpg",JPG
84,image/jpg,null,"null","storybook-6-ch-12","/image/84.jpg",JPG
85,image/jpg,null,"null","storybook-6-ch-13","/image/85.jpg",JPG
86,image/jpg,null,"null","storybook-6-ch-14","/image/86.jpg",JPG
87,image/jpg,null,"null","storybook-6-ch-15","/image/87.jpg",JPG
88,image/jpg,null,"null","storybook-6-ch-16","/image/88.jpg",JPG
89,image/jpg,null,"null","storybook-6-ch-17","/image/89.jpg",JPG
90,image/jpg,null,"null","storybook-6-ch-18","/image/90.jpg",JPG
91,image/jpg,null,"null","storybook-6-ch-19","/image/91.jpg",JPG
92,image/jpg,null,"null","storybook-6-ch-20","/image/92.jpg",JPG
93,image/jpg,null,"null","storybook-6-ch-21","/image/93.jpg",JPG
94,image/jpg,null,"null","storybook-6-ch-22","/image/94.jpg",JPG
95,image/jpg,null,"null","storybook-6-ch-23","/image/95.jpg",JPG
118 changes: 59 additions & 59 deletions src/main/resources/db/content_PROD/ben/letters.csv
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
id,text,allophone_ids,allophone_values_ipa,diacritic,usage_count
2,ে,[7],"[""e""]",true,511
1,া,"[1,18]","[""ɐ"",""ː""]",true,496
4,ি,[6],"[""i""]",true,300
3,র,"[3,10]","[""r"",""ɔ""]",false,281
5,ক,"[12,10]","[""k"",""ɔ""]",false,222
9,ম,"[4,10]","[""m"",""ɔ""]",false,201
7,ব,"[11,10]","[""b"",""ɔ""]",false,169
6,ন,"[22,10]","[""n"",""ɔ""]",false,156
8,ত,"[5,10]","[""t"",""ɔ""]",false,151
12,স,"[33,10]","[""s"",""ɔ""]",false,140
14,ো,[9],"[""o""]",true,138
15,দ,"[14,10]","[""d"",""ɔ""]",false,127
10,ল,"[32,10]","[""l"",""ɔ""]",false,114
20,আ,[1],"[""ɐ""]",false,102
11,ু,[34],"[""u""]",true,102
16,য়,"[21,10]","[""j"",""ɔ""]",false,98
21,খ,"[15,10]","[""kʰ"",""ɔ""]",false,86
19,জ,"[13,10]","[""dʒ"",""ɔ""]",false,82
24,ছ,"[5,43,10]","[""t"",""ʃʰ"",""ɔ""]",false,78
13,প,"[16,10]","[""p"",""ɔ""]",false,72
17,য,"[13,10]","[""dʒ"",""ɔ""]",false,62
18,এ,[7],"[""e""]",false,60
29,ড়,"[27,10]","[""ɽ"",""ɔ""]",false,60
26,চ,"[5,8,10]","[""t"",""ʃ"",""ɔ""]",false,58
33,ফ,"[23,10]","[""pʰ"",""ɔ""]",false,53
25,গ,"[30,10]","[""g"",""ɔ""]",false,52
23,ট,"[44,10]","[""ʈ"",""ɔ""]",false,50
27,শ,"[8,10]","[""ʃ"",""ɔ""]",false,50
22,হ,"[41,10]","[""ɦ"",""ɔ""]",false,49
51,ৈ,"[9,6]","[""o"",""i""]",true,41
30,ও,[9],"[""o""]",false,36
35,ধ,"[20,10]","[""dʱ"",""ɔ""]",false,34
34,ং,[38],"[""ŋ""]",false,23
32,থ,"[24,10]","[""tʰ"",""ɔ""]",false,23
31,ভ,"[17,10]","[""bʱ"",""ɔ""]",false,22
38,ী,"[6,18]","[""i"",""ː""]",true,22
48,ৌ,"[9,34]","[""o"",""u""]",true,22
36,ঁ,"[2,2,2]","[""."",""."","".""]",true,20
28,ই,[6],"[""i""]",false,20
40,উ,[34],"[""u""]",false,20
37,অ,[10],"[""ɔ""]",false,18
53,ঢ়,"[28,10]","[""ɽʱ"",""ɔ""]",false,14
43,ঙ,"[38,10]","[""ŋ"",""ɔ""]",false,12
42,ঠ,"[29,10]","[""ʈʰ"",""ɔ""]",false,12
44,ড,"[40,10]","[""ɖ"",""ɔ""]",false,11
39,ষ,"[8,10]","[""ʃ"",""ɔ""]",false,10
50,ৎ,"[5,10]","[""t"",""ɔ""]",false,6
47,ূ,"[34,18]","[""u"",""ː""]",true,5
57,ঋ,"[3,6]","[""r"",""i""]",false,4
41,ণ,"[22,10]","[""n"",""ɔ""]",false,4
58,ঔ,"[9,34]","[""o"",""u""]",false,3
49,ঝ,"[19,10]","[""dʒʱ"",""ɔ""]",false,3
59,ঈ,[6],"[""i""]",false,2
45,ঘ,"[26,10]","[""ɡʱ"",""ɔ""]",false,2
54,ঢ,"[25,10]","[""ɖʱ"",""ɔ""]",false,2
55,ঃ,"[2,2,2]","[""."",""."","".""]",true,1
1,া,"[1,18]","[""ɐ"",""ː""]",true,1075
2,ে,[7],"[""e""]",true,1040
3,র,"[3,10]","[""r"",""ɔ""]",false,754
4,ি,[6],"[""i""]",true,651
5,ক,"[12,10]","[""k"",""ɔ""]",false,486
6,ন,"[22,10]","[""n"",""ɔ""]",false,432
8,ত,"[5,10]","[""t"",""ɔ""]",false,332
9,ম,"[4,10]","[""m"",""ɔ""]",false,323
7,ব,"[11,10]","[""b"",""ɔ""]",false,303
10,ল,"[32,10]","[""l"",""ɔ""]",false,301
15,দ,"[14,10]","[""d"",""ɔ""]",false,272
12,স,"[33,10]","[""s"",""ɔ""]",false,272
11,ু,[34],"[""u""]",true,238
14,ো,[9],"[""o""]",true,237
16,য়,"[21,10]","[""j"",""ɔ""]",false,199
19,জ,"[13,10]","[""dʒ"",""ɔ""]",false,194
13,প,"[16,10]","[""p"",""ɔ""]",false,187
23,ট,"[44,10]","[""ʈ"",""ɔ""]",false,160
20,আ,[1],"[""ɐ""]",false,149
24,ছ,"[5,43,10]","[""t"",""ʃʰ"",""ɔ""]",false,149
21,খ,"[15,10]","[""kʰ"",""ɔ""]",false,143
22,হ,"[41,10]","[""ɦ"",""ɔ""]",false,131
26,চ,"[5,8,10]","[""t"",""ʃ"",""ɔ""]",false,129
17,য,"[13,10]","[""dʒ"",""ɔ""]",false,125
18,এ,[7],"[""e""]",false,113
29,ড়,"[27,10]","[""ɽ"",""ɔ""]",false,112
27,শ,"[8,10]","[""ʃ"",""ɔ""]",false,111
25,গ,"[30,10]","[""g"",""ɔ""]",false,108
30,ও,[9],"[""o""]",false,87
33,ফ,"[23,10]","[""pʰ"",""ɔ""]",false,78
28,ই,[6],"[""i""]",false,74
37,অ,[10],"[""ɔ""]",false,71
31,ভ,"[17,10]","[""bʱ"",""ɔ""]",false,61
32,থ,"[24,10]","[""tʰ"",""ɔ""]",false,58
35,ধ,"[20,10]","[""dʱ"",""ɔ""]",false,52
40,উ,[34],"[""u""]",false,44
43,ঙ,"[38,10]","[""ŋ"",""ɔ""]",false,42
42,ঠ,"[29,10]","[""ʈʰ"",""ɔ""]",false,41
38,ী,"[6,18]","[""i"",""ː""]",true,41
36,ঁ,"[2,2,2]","[""."",""."","".""]",true,36
34,ং,[38],"[""ŋ""]",false,32
48,ৌ,"[9,34]","[""o"",""u""]",true,25
44,ড,"[40,10]","[""ɖ"",""ɔ""]",false,23
39,ষ,"[8,10]","[""ʃ"",""ɔ""]",false,16
41,ণ,"[22,10]","[""n"",""ɔ""]",false,13
49,ঝ,"[19,10]","[""dʒʱ"",""ɔ""]",false,10
47,ূ,"[34,18]","[""u"",""ː""]",true,10
50,ৎ,"[5,10]","[""t"",""ɔ""]",false,7
45,ঘ,"[26,10]","[""ɡʱ"",""ɔ""]",false,5
54,ঢ,"[25,10]","[""ɖʱ"",""ɔ""]",false,5
52,ঞ,"[22,10]","[""n"",""ɔ""]",false,4
55,ঃ,"[2,2,2]","[""."",""."","".""]",true,2
46,ৃ,"[3,6]","[""r"",""i""]",true,2
56,ঐ,"[9,6]","[""o"",""i""]",false,1
52,ঞ,"[22,10]","[""n"",""ɔ""]",false,1
46,ৃ,"[3,6]","[""r"",""i""]",true,1
60,ঊ,[34],"[""u""]",false,-1
59,ঈ,[6],"[""i""]",false,0
60,ঊ,[34],"[""u""]",false,0
57,ঋ,"[3,6]","[""r"",""i""]",false,0
58,ঔ,"[9,34]","[""o"",""u""]",false,0
51,ৈ,"[9,6]","[""o"",""i""]",true,0
53,ঢ়,"[28,10]","[""ɽʱ"",""ɔ""]",false,0
Loading

0 comments on commit 9f2269e

Please sign in to comment.