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

Skip to content
Snippets Groups Projects
Commit 85b447e4 authored by Michael Breu's avatar Michael Breu
Browse files

sonar

parent c4fcba49
2 merge requests!231New Deployment into production and update gitlab,!225Resolve "Collections mehr hervorheben"
......@@ -292,7 +292,7 @@ public class GitlabService {
fileService.scheduleForDeletion(repo.getDirectory().toPath(), 60);
return repo;
} catch (GitAPIException e) {
log.error("Unable to clone Git repository to temporary directory : {}", e.getMessage(), e);
log.error("Unable to clone Git repository to temporary directory : {}", e.getMessage());
throw new ArtemisImportError("exercise.import.error.checkoutFailed", e);
}
}
......
......@@ -52,11 +52,11 @@ public class AccountResource {
@ResponseStatus(HttpStatus.CREATED)
public void registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM) {
throw new AccountResourceException("Self registration not supported");
// if (isPasswordLengthInvalid(managedUserVM.getPassword())) {
// throw new InvalidPasswordException();
// if (isPasswordLengthInvalid(managedUserVM.getPassword()))
// throw new InvalidPasswordException()
// }
// User user = userService.registerUser(managedUserVM, managedUserVM.getPassword());
// mailService.sendActivationEmail(user);
// User user = userService.registerUser(managedUserVM, managedUserVM.getPassword())
// mailService.sendActivationEmail(user)
}
/**
......
......@@ -15,6 +15,7 @@ import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.codeability.sharing.plugins.api.search.SearchResultDTO;
import org.codeability.sharing.plugins.api.search.util.ExerciseId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -191,18 +192,23 @@ public class StatisticsResource {
log.info("Cannot parse {}", exerciseIdString);
return ResponseUtil.wrapOrNotFound(statisticsDTO);
}
// TODO there is a race condition, if several parallel requests do not find an entry.
if (searchService.findExerciseById(exerciseId).isPresent()) {
// the exercise exists in the meta data search index
StatisticsDTO newStats = new StatisticsDTO();
newStats.setDownloads(0);
newStats.setViews(1);
newStats.setExerciseID(exerciseIdString);
newStats.setBadgeRewarded(false);
statisticsService.save(newStats);
log.debug("Created new statistics entry for exerciseID: {}", exerciseIdString);
statisticsDTO = Optional.of(newStats);
return ResponseUtil.wrapOrNotFound(statisticsDTO);
Optional<SearchResultDTO> exerciseById = searchService.findExerciseById(exerciseId);
if (exerciseById.isPresent()) {
synchronized (this) {
exerciseById = searchService.findExerciseById(exerciseId);
// the exercise exists in the meta data search index
if (exerciseById.isPresent()) {
StatisticsDTO newStats = new StatisticsDTO();
newStats.setDownloads(0);
newStats.setViews(1);
newStats.setExerciseID(exerciseIdString);
newStats.setBadgeRewarded(false);
statisticsService.save(newStats);
log.debug("Created new statistics entry for exerciseID: {}", exerciseIdString);
statisticsDTO = Optional.of(newStats);
return ResponseUtil.wrapOrNotFound(statisticsDTO);
}
}
}
return ResponseUtil.wrapOrNotFound(statisticsDTO);
}
......
......@@ -157,24 +157,6 @@ public class WatchListEntryResource {
.build();
}
// /**
// * {@code SEARCH /_search/watch-list-entries?query=:query} : search for the watchListEntry corresponding
// * to the query.
// *
// * @param query the query of the watchListEntry search.
// * @param pageable the pagination information.
// * @return the result of the search.
// */
// @GetMapping("/_search/watch-list-entries")
// public ResponseEntity<List<WatchListEntryDTO>> searchWatchListEntries(@RequestParam String query,
// Pageable pageable) {
// log.debug("REST request to search for a page of WatchListEntries for query {}", query);
// Page<WatchListEntryDTO> page = watchListEntryService.search(query, pageable);
// HttpHeaders headers = PaginationUtil
// .generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
// return ResponseEntity.ok().headers(headers).body(page.getContent());
// }
@GetMapping("/user-watch-lists/{id}/entries")
public ResponseEntity<List<WatchListEntryDTO>> getWatchListEntries(@PathVariable Long id) {
return ResponseEntity.ok().body(watchListEntryService.getEntriesForWatchlist(id));
......
/* eslint @typescript-eslint/no-var-requires: "off" */
const { generateTSFiles } = require('swagger-ts-generator');
// const config = {
// file: __dirname + '\\swagger.json'
// };
generateTSFiles(
// Better read from URL http://localhost:8080/v2/api-docs
{
......
......@@ -7,12 +7,6 @@
<div>
<jhi-alert-error></jhi-alert-error>
<!--
<div class="form-group" [hidden]="!editForm.get('id')!.value">
<label for="id" jhiTranslate="global.field.id">ID</label>
<input type="text" class="form-control" id="id" name="id" formControlName="id" readonly />
</div>
-->
<div class="form-group">
<label class="form-control-label" jhiTranslate="gitsearchApp.userWatchList.name" for="fields">Name</label>
<input type="text" class="form-control" name="name" id="field_name" formControlName="name" />
......@@ -44,22 +38,6 @@
<option value="MONTHLY">{{ 'gitsearchApp.CheckFrequency.MONTHLY' | translate }}</option>
</select>
</div>
<!--
<div class="form-group">
<label class="form-control-label" jhiTranslate="gitsearchApp.userWatchList.userId" for="field_userId">User Id</label>
<select class="form-control" id="field_userId" name="userId" formControlName="userId">
<option *ngIf="!editForm.get('userId')!.value" [ngValue]="null" selected></option>
<option [ngValue]="userOption.id" *ngFor="let userOption of users; trackBy: trackById">{{ userOption.login }}</option>
</select>
</div>
<div *ngIf="editForm.get('userId')!.invalid && (editForm.get('userId')!.dirty || editForm.get('userId')!.touched)">
<small class="form-text text-danger"
*ngIf="editForm.get('userId')?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
-->
</div>
<div>
......
......@@ -234,7 +234,7 @@ export class BookmarkComponent implements OnInit, OnDestroy {
this.allLoaded = true;
}
}
++this.page; // TODO this may result in a race condition, if requests are not returned in sequence :-()
++this.page; // Cave'at: this may result in a race condition, if requests are not returned in sequence :-()
},
error: () => alert('Search failed'),
});
......
......@@ -166,11 +166,6 @@
<li *ngFor="let childInfo of getChildrenInfos()" (click)="toExercise(childInfo.childId)" style="cursor: zoom-in">
<span>
{{ childInfo.title }}
<!--
<fa-icon
style="padding: 5px 0px 0px 5px; float: left"
[icon]="faArrowRight"
></fa-icon>-->
</span>
</li>
</ul>
......
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