Commit Graph

218 Commits

Author SHA1 Message Date
1554d4bc27 Enforce code formatting via Prettier (#44)
All checks were successful
Build and test / build-and-test (push) Successful in 11m55s
Fixes #43 by introducing [Prettier](https://prettier.io/).

Prettier is an extremely opinionated formatter. It will reformat every single line according to its style. There are virtually no configuration options so there can be no discussion about formatting rules.

There are two parameters that are configurable; indent length and line length. Indent length has been set to 4 because that's the Java standard.

Line length defaults to 80 but has been increased to 100. The rational for this is that Prettier was created for JavaScript which is much less verbose than Java. Not only does every Java line start with 8 spaces of indentation vs. JavaScripts 0 or 2, it also has types wile JavaScript does not and uses `const` for variable declarations. Compare the two below examples as well as an actual example from the source code that is too long for the default 80 characters. I have no problem dropping down to the default 80 if that is preferred I just felt that with the average length of a line of Java code being pretty long, excessive wrapping would reduce readability.

```javascript
  const attributes = {
    ...
  };
```
```java
        Map<String, String> attributes = Map.of(
            ...
        );
```

Or the following real code which is 97 characters long.
```java
        Set<ProjectParticipant> contributors = daisyAPI.getContributors(project.getIdentifier());
```

Reviewed-on: #44
Reviewed-by: Tom Zhao <tom.zhao@dsv.su.se>
Co-authored-by: Andreas Svanberg <andreass@dsv.su.se>
Co-committed-by: Andreas Svanberg <andreass@dsv.su.se>
2024-12-02 14:17:59 +01:00
03ad12f435 Do not add duplicate supervisors in Daisy (#26)
All checks were successful
Build and test / build-and-test (push) Successful in 6m40s
Daisy's API does not support the function "change supervisor" and only what comes down to SQL INSERT and DELETE on a specific table. If the removal of the previous supervisor(s) failed the new one was still added. This change makes it so that if the removal of any (there is no limit in the API) current supervisor fails it will not attempt to add the new supervisor.

Fixes #39

## How to test
1. Configure the Daisy integration in SciPro
2. Enable it (Maven profile)
3. The only currently known way to make removing a supervisor fail is to use a project where they've sent the thesis to the examiner
4. Find one such project in the test server for Daisy (or send one for examination from SciPro)
5. Change the supervisor of the project in SciPro
6. Run the job "Export projects to daisy" (System / Maintenance)
7. See that it logs the failure and that no duplicate supervisors were added to Daisy

Reviewed-on: #26
Reviewed-by: Tom Zhao <tom.zhao@dsv.su.se>
Co-authored-by: Andreas Svanberg <andreass@dsv.su.se>
Co-committed-by: Andreas Svanberg <andreass@dsv.su.se>
2024-12-02 11:28:37 +01:00
ccac2c1cf8 Enable creating an API using Spring Web (#5)
All checks were successful
Build and test / build-and-test (push) Successful in 6m54s
SciPro will have to provide information to the upcoming student portal. Wicket does not have the ability to serve JSON in the usual REST way and is only able to serve HTML. The most common way to write JSON over HTTP API:s in Java is using Spring Web, but currently SciPro uses Guice for dependency injection rather than Spring which makes adding Spring Web a bit more tricky.

This pull request attempts to solve this by doing the following;
* Replacing Guice with Spring
* Adding a new API module that uses Spring Web
* Turning the entire system into a standard Spring Boot web application

The hope is that these changes will bring the following benefits;
* Harmonize our web stack (Daisy uses Spring and the new lecture hall system is full Spring Boot)
* Enable easy development of a traditional JSON over HTTP API
* Ease future recruitment by using the most common Java web frameworks

Reviewed-on: #5
Reviewed-by: niat8586 <nico@dsv.su.se>
Co-authored-by: Andreas Svanberg <andreass@dsv.su.se>
Co-committed-by: Andreas Svanberg <andreass@dsv.su.se>
2024-11-06 11:23:28 +01:00
d8e4f0dd22 Stop confusing Spring Boot with copied classes
These classes were copied from Spring Data a long time ago. Their existence on the class path confuses Spring Boot into thinking we use Spring Data JPA which we do not.
2024-10-28 14:02:31 +01:00
f072429753 3351 Upgrade to Wicket 10
Related Jakarta migration upgrades as well
2024-03-14 15:09:49 +01:00
nikos dimitrakas
91d2bc3559 3227 TR kodformatering 2023-12-01 15:40:40 +01:00
3f8cf007e7 2960 Import national subject categories.
For future use by supervisors to fill in as part of the publication metadata.
2023-11-23 12:30:46 +01:00
9ede3a270d 3245 Create project in Daisy at course start (from idea) instead of waiting on the daily sync 2023-11-21 15:04:07 +01:00
cce458f98a 3227 Formatting 2023-11-02 14:38:05 +01:00
c91817c55a 3227 Sync reviewer changes to Daisy immediately 2023-11-02 10:52:17 +01:00
2b14fd0ede 2984 PO 8) Save final thesis rejection comment 2023-10-24 10:44:34 +02:00
903ade76db 2984 PO 4) Save every approval by the examiners 2023-09-12 14:04:57 +02:00
3e408d143c 2984 PO 4) Save every rejection by an examiner 2023-09-12 11:55:15 +02:00
nikos dimitrakas
e861c0dce4 3137 Anpassade SciPro till den nya xsd:n för Daisys API. 2023-06-29 16:16:53 +02:00
7c42ba67dc 3116 Handle projects without Daisy connection when performing the final steps as an author 2023-06-09 09:56:06 +02:00
nikos dimitrakas
cd4cb23b93 Ny xsd för API:et efter 3013 (stöd för nyckelord för examensarbetespublikationer) 2023-06-02 06:16:13 +02:00
bf5c11e6c9 Better handling of changes in the Daisy API by getting compiler errors with mismatched XSD. 2023-03-28 10:11:14 +02:00
deff20cfc7 Only import Stockholm University usernames
Improve user search experience since it searches by username, so we don't want a bunch of usernames from other places to interfere.
2023-03-28 10:09:49 +02:00
dcad2c82b2 Sonar. 2022-12-06 16:54:10 +01:00
9a18d62d3e 2054 Search should work when API is offline. Turn off searching in Daisy when profile DAISY-INTEGRATION is turned off. 2022-12-06 16:22:37 +01:00
4fc1a661f7 2874 Allow authors to give consent to publish their thesis 2022-11-22 12:08:01 +01:00
nikos dimitrakas
f4db44ffaf 2873 Anpassningar av SciPro för ändringarna i API:et inklusive ny xsd. 2022-11-21 15:11:04 +01:00
9c1481626a Merge branch 'develop' into 2856 2022-10-25 20:40:47 +02:00
e02006bfd1 Upgrade to servlet specification 4.0 2022-10-18 12:14:42 +02:00
1826ab5aa8 2891 Upgrade Hibernate and Jersey 2022-10-05 14:34:59 +02:00
fc76a7ec98 Remove manual tracing instrumentation.
Use the Java Agent instead.
2022-09-28 14:58:53 +02:00
e811fd04e2 Switch to the new Jakarta dependencies for API specification. 2022-09-28 11:11:47 +02:00
6765da6480 Remove MOXy for XML/JSON (de)serialization
We now use JAXB for XML and Jackson for JSON. MOXy complects the two and make it harder to control the specific input/output expected.
2022-09-28 11:08:53 +02:00
264fcb754a Remove dependency on joda-time 2022-09-22 12:53:50 +02:00
20b392b964 2856 Supervisors must provide information on how the rejection comment from the examiner has been rectified.
PSAM (represented by Panos), Paul, and Jakob decided in a meeting on sep 8 2022 that supervisors must provide feedback as to how the examiners rejection comment has been rectified.
2022-09-21 11:23:25 +02:00
5ece9dda93 2828 Give project start date its own attribute instead of stealing audit data 2022-08-31 14:49:58 +02:00
26f81ae5fe 2562 Use the new endpoint for adding authors 2022-05-19 17:38:02 +02:00
942070a147 2562 Update Daisy API XSD 2022-05-19 12:35:38 +02:00
ddc28cc598 2515 Sync theses' research area to Daisy 2022-05-09 13:49:25 +02:00
nikos dimitrakas
597b753fc1 Merge remote-tracking branch 'origin/develop' into develop 2022-04-22 14:56:50 +02:00
nikos dimitrakas
85219dc151 Harmoniserade interface 2022-04-22 14:56:35 +02:00
b7c42aa13e 2484 TR 2022-04-13 12:36:28 +02:00
71ab3ab4eb 1684 Sync all research areas 2022-03-31 12:15:08 +02:00
nikos dimitrakas
0972c592ce 2528 Exkluderade avslutade och avbrutna projekt från synkningen som görs inom varje handledare. Verkar onödigt och tog tid. Refaktoriseringar enligt intellij. Harmoniserade @Transactional på de publika metoderna och tog bort en från en privat metod. Självaste problemet med att jobbets workerdata inte sparas kvarstår och beror på något med transaktionshanteringen i metoden UserImportWorker.importPotentialNewStudentsAndUpdatePrograms. Det är em.refresh(wd) på rad 88 i AbstractWorker som kastar en Exception. 2022-03-07 11:16:40 +01:00
4dff775a97 Upgrade Mockito and JUnit 2021-11-29 15:33:57 +01:00
061320d27d 2409 Update students programs 2021-11-28 16:21:14 +01:00
d359056cc6 2401 Only write examiners comment if it's new 2021-11-08 11:08:34 +01:00
99a002a628 2395 Rejection comments from reviewer is posted by the system instead of the supervisor
43/62
2021-11-08 00:58:06 +01:00
26c171a898 Check for rejections once per day 2021-11-07 23:32:04 +01:00
c64989b60e 2361 TR Publicera examinatorns kommentarer i forum när en uppsats avvisas 2021-10-25 16:27:56 +02:00
2dcd137bb3 2361 Post examiner rejection comment in forum 2021-10-13 17:08:00 +02:00
89d3d93cf8 Upgrade to Mockito 4
41/62
2021-10-13 16:17:16 +02:00
888b58202a 2353 Replace var with explicit type 2021-09-22 20:03:39 +02:00
879d9b4159 2082: TR Bättre namn på klasser, enums, variabler, kolumnnamn, etc. Uppgraderade xsd:n för API:et. 2021-09-15 16:34:56 +02:00
6da2dfb8d6 2082 Set default degree level to bachelor unless otherwise determined 2021-09-09 11:54:00 +02:00