This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit b101146b authored by Michael Breu's avatar Michael Breu :speech_balloon:
Browse files

Merge branch '550-reviewbadge-wird-nicht-in-elasticsearch-eingetragem' into 'development'

Draft: Resolve "Reviewbadge wird nicht in elasticsearch eingetragem."

See merge request !276
parents c03cd55d 17edceaa
Branches
2 merge requests!277Bringing fixes to production,!276Resolve "Reviewbadge wird nicht in elasticsearch eingetragem."
......@@ -12,7 +12,7 @@ services:
- _JAVA_OPTIONS=-Xmx512m -Xms256m
- SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE}
- MANAGEMENT_METRICS_EXPORT_PROMETHEUS_ENABLED=true
- SPRING_DATASOURCE_URL=jdbc:mysql://sharing_mysql:3306/gitsearch?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&createDatabaseIfNotExist=true
- SPRING_DATASOURCE_URL=jdbc:mysql://sharing_mysql:3306/gitsearch?useUnicode=true&allowPublicKeyRetrieval=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&createDatabaseIfNotExist=true
- JHIPSTER_SLEEP=5 # gives a small time for other services to boot before the application
- SPRING_DATA_JEST_URI=http://sharing_elasticsearch:9200
- SPRING_ELASTICSEARCH_REST_URIS=http://sharing_elasticsearch:9200
......@@ -91,7 +91,6 @@ services:
GITLAB_HOME: $GITLAB_HOME
EXTERNAL_URL: $EXTERNAL_URL
GITLAB_HOSTNAME: $GITLAB_HOSTNAME
GITLAB_API_ROOT_ACCESS_TOKEN: $GITLAB_API_ROOT_ACCESS_TOKEN
INDEXING_SERVICE_URL: $INDEXING_SERVICE_URL
MAIL_USERNAME: $MAIL_USERNAME
MAIL_PASSWORD: $MAIL_PASSWORD
......
......@@ -35,10 +35,11 @@ It can be executed as follows:
- ``. .env`` the .env file can be found in the KeePass file. It contains the secrets for the containers. A current version of .env can be found in the keepass file.
- ``export GITLAB_HOME``
- ``export INDEXING_SERVICE_URL``
- ``export GITBRANCH=development # or some other gitlab branch``
- ``export COMMIT_ID=$(git rev-parse HEAD); export COMMIT_DATE=$(git show -s --format=%ct``
- ``docker-compose -f gitsearch.yml create gitlab`` # this may fail, if the format of the gitsearch-app version needs to be adapted.
.. note::
the command may complain about missing variables COMMIT_ID, COMMIT_DATE, GITLAB_API_ROOT_ACCESS_TOKEN. This is ok, since the variables are only used in the gitlab container.
the command may complain about missing variables COMMIT_ID, COMMIT_DATE. This is ok, since the variables are only used in the gitlab container.
- ``docker-compose -f gitsearch.yml up -d gitlab plantuml elasticsearch``
The following environment variables are set within the config files.
......
......@@ -41,6 +41,24 @@ public class StatisticsService {
* @param statisticsDTO the entity to save.
* @return the persisted entity.
*/
/**
* Save a statistics.
*
* @param statisticsDTO the entity to save.
* @return the persisted entity.
*/
public Statistics save(Statistics statistics) {
final Statistics stats = statisticsRepository.save(statistics);
StatisticsDTO statisticsDto = new StatisticsDTO();
statisticsDto.setId(statistics.getId());
statisticsDto.setExerciseID(statistics.getExerciseID());
statisticsDto.setDownloads(statistics.getDownloads());
statisticsDto.setViews(statistics.getViews());
statisticsDto.setBadgeRewarded(statistics.getBadgeRewarded());
updateSearchResult(statisticsDto);
return stats;
}
public StatisticsDTO save(StatisticsDTO statisticsDTO) {
Statistics statistics = new Statistics();
statistics.setId(statisticsDTO.getId());
......@@ -50,6 +68,11 @@ public class StatisticsService {
statistics.setBadgeRewarded(statisticsDTO.getBadgeRewarded());
statisticsRepository.save(statistics);
updateSearchResult(statisticsDTO);
return statisticsDTO;
}
protected void updateSearchResult(StatisticsDTO statisticsDTO) {
try {
final SearchResultDTO searchResultDTO = elasticSearchRepository.get(statisticsDTO.getExerciseID());
if (searchResultDTO != null) {
......@@ -59,7 +82,6 @@ public class StatisticsService {
} catch (IOException e) {
log.error("Cannot update statistics for {}", statisticsDTO.getExerciseID(), e);
}
return statisticsDTO;
}
/**
......@@ -152,7 +174,7 @@ public class StatisticsService {
if (statistics.isPresent()) {
Statistics statistics1 = statistics.get(); // get last
statistics1.setBadgeRewarded(true);
statisticsRepository.save(statistics1);
save(statistics1);
log.debug("Badge rewarded for exercise: {}", exerciseID);
} else {
log.debug("No statistics found for exercise: {}", exerciseID);
......
......@@ -56,6 +56,7 @@
"IMPROVEMENTS_REQUESTED": "Verbesserungen angefordert",
"REVIEW_REJECTED": "Überprüfung abgelehnt",
"REVIEW_COMPLETED": "Überprüfung abgeschlossen",
"REVIEW_IMPROVED": "Aufgabe verbessert",
"askQuestion": "Chatte mit dem Ersteller",
"send": "Senden",
"typeMessage": "Nachricht für alle eingeben...",
......
......@@ -57,6 +57,7 @@
"IMPROVEMENTS_REQUESTED": "Improvements Requested",
"REVIEW_REJECTED": "Review Rejected",
"REVIEW_COMPLETED": "Review Completed",
"REVIEW_IMPROVED": "Exercise improved",
"askQuestion": "Chat with creator",
"askReviewers": "Chat with reviewers",
"send": "Send",
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment