Skip to content

Commit

Permalink
Merging master and resolving merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dadepo committed Dec 2, 2017
2 parents ee64aa2 + 15f8f0b commit 8412c99
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,7 @@ public List<NameEntry> loadAllNames(Optional<Integer> pageNumberParam, Optional<
new PageRequest(pageNumber == 0 ? 0 : pageNumber - 1, count, Sort.Direction.ASC, "id");

Page<NameEntry> pages = nameEntryRepository.findAll(request);
pages.forEach(page -> {
nameEntries.add(page);
});
pages.forEach(nameEntries::add);

return nameEntries;
}
Expand All @@ -213,10 +211,7 @@ public List<NameEntry> loadAllNames(Optional<Integer> pageNumberParam, Optional<
* @return list of {@link NameEntry}. If state is not present, it returns an empty list
*/
public List<NameEntry> loadAllByState(Optional<State> state) {
if (!state.isPresent()) {
return Collections.emptyList();
}
return nameEntryRepository.findByState(state.get());
return state.map(s -> nameEntryRepository.findByState(s)).orElseGet(Collections::emptyList);
}

/**
Expand All @@ -232,8 +227,8 @@ public List<NameEntry> loadByState(Optional<State> state, Optional<Integer> page
return this.loadAllNames(pageParam, countParam);
}

final Integer page = pageParam.isPresent() ? pageParam.get() - 1 : 1;
final Integer count = countParam.isPresent() ? countParam.get() : COUNT_SIZE;
final Integer page = pageParam.map(integer -> integer - 1).orElse(1);
final Integer count = countParam.orElse(COUNT_SIZE);

return nameEntryRepository.findByState(state.get(), new PageRequest(page,count));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ public String[] getMostPopular() {
List<Map<String, Integer>> frequency = getNameWithSearchFrequency();
List<String> mostPopular = new ArrayList<>();

frequency.stream().forEach(name -> {
mostPopular.add((String) name.keySet().toArray()[0]);
});
frequency.stream().forEach(name -> mostPopular.add((String) name.keySet().toArray()[0]));

if (mostPopular.size() > popularListLimit) {
return mostPopular.subList(0, popularListLimit).toArray(new String[popularListLimit]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ public ResponseEntity<Map<String, String>> deleteAllFeedbackForName(@RequestPara
}
final Sort sort = new Sort(Sort.Direction.DESC, "submittedAt");
List<NameEntryFeedback> feedbacks = feedbackRepository.findByName(name, sort);
feedbacks.stream().forEach(feedback -> {
feedbackRepository.delete(feedback);
});
feedbacks.stream().forEach(feedback -> feedbackRepository.delete(feedback));

return new ResponseEntity<>(response("All Feedback messages deleted for "+ name), HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,11 @@ public ResponseEntity< Map<String, String>> updateNames(@Valid @RequestBody Name
entryService.bulkUpdateNames(foundNames);

List<String> notFound = notFoundNames.stream()
.map(notFoundName -> notFoundName.getName())
.map(NameEntry::getName)
.collect(Collectors.toList());

List<String> found = foundNames.stream()
.map(foundName -> foundName.getName())
.map(NameEntry::getName)
.collect(Collectors.toList());

String responseMessage = String.join(",", found) + " updated. ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void testdeleteNameEntryAndDuplicates() {

@Test
public void testDeleteInDuplicateEntry() throws Exception {
DuplicateNameEntry duplicateNameEntry = mock(DuplicateNameEntry.class);;;;
DuplicateNameEntry duplicateNameEntry = mock(DuplicateNameEntry.class);
nameEntryService.deleteInDuplicateEntry(duplicateNameEntry);
verify(duplicateEntryRepository).delete(duplicateNameEntry);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
@SpringBootApplication
@EnableCaching
@EnableSwagger2
//@EnableWebSecurity //switches off auto configuration for spring security
public class DictionaryApplication extends WebMvcConfigurerAdapter {

private final String LANG = "lang";
Expand Down Expand Up @@ -99,8 +98,7 @@ public ReloadableResourceBundleMessageSource messageSource() {
return source;
}


// @Bean
@Bean
public net.sf.ehcache.CacheManager ecacheManager() {
CacheConfiguration allNames = new CacheConfiguration();
allNames.setName("allNames");
Expand All @@ -120,17 +118,10 @@ public net.sf.ehcache.CacheManager ecacheManager() {
names.setEternal(false);
names.setTimeToIdleSeconds(1800);

// CacheConfiguration nameCount = new CacheConfiguration();
// nameCount.setName("nameCount");
// nameCount.setMaxEntriesLocalHeap(0);
// nameCount.setEternal(false);
// nameCount.setTimeToIdleSeconds(1800);

net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration();
config.addCache(allNames);
config.addCache(querySearchResult);
config.addCache(names);
//config.addCache(nameCount);

return net.sf.ehcache.CacheManager.newInstance(config);
}
Expand Down
2 changes: 1 addition & 1 deletion website/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lang.most-popular-names=Most Popular Names
lang.name-of-day=Name of the day
lang.play-sound=Click to hear pronunciation
lang.submitby=Submitted by
lang.pronounciation=Pronounciation
lang.pronunciation=Pronunciation
lang.share=Share
lang.improve-entry=Improve this entry
lang.meaningof=Meaning of
Expand Down
6 changes: 3 additions & 3 deletions website/src/main/resources/messages_yo.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lang.most-popular-names=Àwọn Orúkọ Tó Gbajúmọ̀ Jù
lang.name-of-day=Orúkọ Ojúmọ́
lang.play-sound=Tẹ̀ láti gbọ́ ohùn
lang.submitby=Ẹni tó fún wa ni
lang.pronounciation=Sísọ síta
lang.pronunciation=Sísọ síta
lang.share=Fihànká
lang.improve-entry=Tún orúkọ yìí ṣe
lang.meaningof=Ìtumọọ
Expand Down Expand Up @@ -85,5 +85,5 @@ lang.key-supporters=Àwọn agbèlẹ́yìn wa pàtàkì
lang.yoruba-name-dictionary=Dikṣọ́nárì Orúkọ Yorùbá

lang.yoruba-name-newsletter=Ìwé Ìròyìn YorubaName
lang.follow-update=Follow us behind the scenes for exclusive news, freebies, links, lexicographer tools, and other important updates about this dictionary.
lang.enter-your-email=Enter your email here
lang.follow-update=Tẹ̀lé wa wọlé láti gba ojúlówó ìròyìn, oun ọ̀fẹ́, ìsopọ̀, oun èlò àwọn onímọ̀ èdè, àti oríṣiríṣi ìròyìn pàtàkì nípa dikṣọ́nárì yìí.
lang.enter-your-email=Tẹ email rẹ síbí
4 changes: 2 additions & 2 deletions website/src/main/resources/website/contactus.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
<p class="lead">{{message "lang.contact-info-preamble"}}</p>

<p>{{message "lang.contact-info-email-preamble"}} <a href="mailto:[email protected]">[email protected]</a></p>
<p>Or visit our office at YorubaName.com<br>
<p>{{message "lang.contact-info-contact-preamble"}}<br>
2nd Floor, The Garnet Building<br>
Lekki - Epe Express Road, Lekki<br>
Lagos 101245<br>
Nigeria
</p>

<p class="lead">Follow us on Social Media</p>
<p class="lead">{{message "lang.social-media"}}</p>
<nav class="social-links">
<a href="https://facebook.com/YorubaNames" target="_blank"><i class="fa fa-facebook"></i></a>
<a href="https://twitter.com/YorubaNames" target="_blank"><i class="fa fa-twitter"></i></a>
Expand Down
13 changes: 7 additions & 6 deletions website/src/main/resources/website/home.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,17 @@
<div class="container">
<div class="row">
<div class="col-sm-12 text-center"><h3>{{message "lang.key-supporters"}}</h3></div>
<div class="col-sm-2 col-sm-offset-2"><a href="http://capitalsqua.re/" target="_blank"><img
class="img-responsive" src="/assets/img/supporters/capital_square.png"></a></div>
<div class="col-sm-2"><a href="http://www.goethe.de/ins/ng/en" target="_blank"><img class="img-responsive"
src="/assets/img/supporters/goethe_institut.png"></a>
<div class="col-sm-2 col-sm-offset-2"><a href="http://www.oraturelab.com" target="_blank">
<img class="img-responsive" src="/assets/img/supporters/orature_lab.png"></a>
</div>
<div class="col-sm-2"><a href="http://capitalsqua.re/" target="_blank">
<img class="img-responsive" src="/assets/img/supporters/capital_square.png"></a>
</div>
<div class="col-sm-2"><a href="http://www.alt-i.org/index.php" target="_blank"><img class="img-responsive"
src="/assets/img/supporters/alti.png"></a>
</div>
<div class="col-sm-2"><a href="http://lgmediting.com/" target="_blank"><img class="img-responsive"
src="/assets/img/supporters/lgmediting-logo.png"></a>
<div class="col-sm-2"><a href="http://www.alt-i.org/index.php" target="_blank">
<img class="img-responsive" src="/assets/img/supporters/alti.png"></a>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion website/src/main/resources/website/singleresult.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<h2 class="intonation" id="name-entry">{{name.name }}</h2>

<p><strong>{{message "lang.pronounciation"}}</strong>
<p><strong>{{message "lang.pronunciation"}}</strong>
<button class="btn btn-default btn-sm" id="tts-button">
<i class="fa fa-volume-up" data-placement="top" title="{{message "lang.play-sound"}}"></i>
</button>
Expand Down

0 comments on commit 8412c99

Please sign in to comment.