Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
Paul-Christian Volkmer
ARSnova Backend
Commits
0d50fb15
Commit
0d50fb15
authored
9 years ago
by
Christoph Thelen
Browse files
Options
Downloads
Patches
Plain Diff
Delete sort order documents when deleting a session
parent
079b2e52
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/thm/arsnova/dao/IDatabaseDao.java
+2
-2
2 additions, 2 deletions
src/main/java/de/thm/arsnova/dao/IDatabaseDao.java
src/main/java/de/thm/arsnova/services/SessionService.java
+25
-0
25 additions, 0 deletions
src/main/java/de/thm/arsnova/services/SessionService.java
with
27 additions
and
2 deletions
src/main/java/de/thm/arsnova/dao/IDatabaseDao.java
+
2
−
2
View file @
0d50fb15
...
...
@@ -29,9 +29,9 @@ import de.thm.arsnova.entities.LoggedIn;
import
de.thm.arsnova.entities.Question
;
import
de.thm.arsnova.entities.Session
;
import
de.thm.arsnova.entities.SessionInfo
;
import
de.thm.arsnova.entities.SortOrder
;
import
de.thm.arsnova.entities.Statistics
;
import
de.thm.arsnova.entities.User
;
import
de.thm.arsnova.entities.SortOrder
;
import
de.thm.arsnova.entities.transport.ImportExportSession
;
public
interface
IDatabaseDao
{
...
...
@@ -204,7 +204,7 @@ public interface IDatabaseDao {
SortOrder
createOrUpdateSortOrder
(
SortOrder
sortOrder
);
SortOrder
getSortOrder
(
String
session
key
,
String
questionVariant
,
String
subject
);
SortOrder
getSortOrder
(
String
session
Id
,
String
questionVariant
,
String
subject
);
void
deleteSortOrder
(
SortOrder
sortOrder
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/de/thm/arsnova/services/SessionService.java
+
25
−
0
View file @
0d50fb15
...
...
@@ -18,6 +18,7 @@
package
de.thm.arsnova.services
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.UUID
;
...
...
@@ -41,6 +42,7 @@ import de.thm.arsnova.entities.LearningProgressOptions;
import
de.thm.arsnova.entities.Session
;
import
de.thm.arsnova.entities.SessionFeature
;
import
de.thm.arsnova.entities.SessionInfo
;
import
de.thm.arsnova.entities.SortOrder
;
import
de.thm.arsnova.entities.User
;
import
de.thm.arsnova.entities.transport.ImportExportSession
;
import
de.thm.arsnova.entities.transport.LearningProgressValues
;
...
...
@@ -327,6 +329,29 @@ public class SessionService implements ISessionService, ApplicationEventPublishe
@PreAuthorize
(
"isAuthenticated() and hasPermission(#sessionkey, 'session', 'owner')"
)
public
void
deleteSession
(
final
String
sessionkey
)
{
final
Session
session
=
databaseDao
.
getSessionFromKeyword
(
sessionkey
);
List
<
String
>
prepSubjects
=
databaseDao
.
getSubjects
(
session
,
"preparation"
);
if
(
prepSubjects
==
null
)
{
prepSubjects
=
new
ArrayList
<
String
>();
}
else
{
prepSubjects
.
add
(
""
);
}
List
<
String
>
lectureSubjects
=
databaseDao
.
getSubjects
(
session
,
"lecture"
);
if
(
lectureSubjects
==
null
)
{
lectureSubjects
=
new
ArrayList
<
String
>();
}
else
{
lectureSubjects
.
add
(
""
);
}
for
(
String
subject
:
prepSubjects
)
{
SortOrder
sortOrder
=
databaseDao
.
getSortOrder
(
session
.
get_id
(),
"preparation"
,
subject
);
databaseDao
.
deleteSortOrder
(
sortOrder
);
}
for
(
String
subject
:
lectureSubjects
)
{
SortOrder
sortOrder
=
databaseDao
.
getSortOrder
(
session
.
get_id
(),
"lecture"
,
subject
);
databaseDao
.
deleteSortOrder
(
sortOrder
);
}
databaseDao
.
deleteAllQuestionsWithAnswers
(
session
);
databaseDao
.
deleteSession
(
session
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment