900 Commits

Author SHA1 Message Date
b79f0015ad Fix rubocop offenses 2023-04-03 15:08:30 +02:00
72ca8c57de Reduce SQL queries for querying tips.
Closes CODEOCEAN-KY
2023-04-02 17:11:53 +02:00
0aa73d30e9 Reduce SQL queries for querying files when creating submissions
This is especially useful for the RemoteEvaluationsController.

Closes CODEOCEAN-KX
2023-04-02 17:05:22 +02:00
e8a21ea319 Further optimize extracting errors
The previous solution worked, but always queried all ErrorTemplateAttributes, even if there was no match of the ErrorTemplate. This solution resolves this issue and still benefits from less SQL queries.
2023-03-21 07:34:31 +01:00
7af7484f7a Improve performance of the FlowrController 2023-03-20 23:52:55 +01:00
09809cc12e Preload error template attributes in SubmissionsController
The join operation is okay, since a similar one is otherwise performed automatically by Rails
2023-03-20 23:52:34 +01:00
6d3587e813 Rescue network-related issues in transmitting LTI scores
Fixes CODEOCEAN-JS
2023-03-15 13:05:46 +01:00
a7cd85507e Reduce SQL queries in the exercise controller
Fixes CODEOCEAN-JK
2023-03-14 20:58:21 +01:00
5ddad9e83d Rescue network-related issues in transmitting LTI scores
Fixes CODEOCEAN-JT
2023-03-14 15:34:28 +01:00
939b31967f Reduce SQL queries for score runs
Fixes CODEOCEAN-JR
2023-03-14 13:56:23 +01:00
0dd931fba1 Add runner management health check for /ping
Even though we can check the health of the runner management, we would like to ensure an external health check validates the availability of all required services.
2023-03-13 22:54:14 +01:00
0643bc8c0c Redirect health check monitoring to /ping
We previously optimized the SQL queries, so that anonymous users without any cookie sent no longer result in a database query. This is generally awesome, but it also allows our health check monitoring to pass even when no database connection can be established.
2023-03-13 22:11:53 +01:00
5c98ec74f0 Add legal links to Help modal 2023-02-24 19:55:23 +01:00
d6c95dd383 Default to first page for RfC pages 2023-02-22 00:05:33 +01:00
2e825f2413 Fix pagination for RfCs 2023-02-21 23:44:34 +01:00
7fe0fc02e2 Set Sentry context for RailsAdmin 2023-02-21 11:35:29 +01:00
af843231d9 Add user details to RemoteEvaluationsController 2023-02-21 10:45:00 +01:00
ddf041ac05 Check RfC visibility before redirecting users 2023-02-21 10:01:01 +01:00
d0b713ddcd Dramatically improve RfC query
While the code gets more complex, the new query will first filter all relevant RfCs and only use the `with_last_activity` scope for the current page.

Using `distinct` in the policy is not required (no duplicated RfCs), but causes issues for the ordering otherwise. Therefore, it is removed.

Fixes CODEOCEAN-J2
2023-02-21 01:27:32 +01:00
d0717fb178 Reduce SQL queries for RfC index actions
By using includes and carefully selecting objects through references, all required objects are only queried once.
2023-02-20 23:47:06 +01:00
9c3392b324 Add consumer-based RfC Visibility settings
This setting will be useful to increase data protection, where users might not be allowed to see RfCs from other contexts.
2023-02-20 23:47:06 +01:00
40c7a50834 Directly use ActiveRecord object instead of ID
This change will improve the performance by reducing unnecessary SELECT queries.
2023-02-18 19:28:26 +01:00
6465404ebe Set sentry context after logging in 2023-02-18 19:27:46 +01:00
9c3ec3c7ff Refactor submission scoring and testing
* Properly cancel code execution if running is prohibited
* Correctly monitor duration with Sentry
* Align methods with running submissions
2023-02-17 18:13:48 +01:00
a1ec4579fe Properly cancel code execution if running is prohibited 2023-02-17 18:13:48 +01:00
326b5fce51 Allow assigning tips during exercise create
Fixes CODEOCEAN-H6
2023-02-16 11:23:52 +01:00
e9cf79085a Refactor listing files to be independent of exiting runners
Previously, we were always fetching files, even if not required (e.g., for score runs). Now, we reduce the number of file listings and use a dedicated callback.
2023-02-16 10:50:01 +01:00
91c2e14fe8 Fix error handling during Runner::Connection close
Closes CODEOCEAN-HQ
2023-02-16 10:47:28 +01:00
596a04b9da Handle ReadTimeouts for LTI consumer properly 2023-02-16 10:12:05 +01:00
04504973ba Adjust Sentry's user context 2023-02-03 00:16:52 +01:00
234a4fe02b Deny /implement without execution environment
Also, fix a smaller typo in the locales
2023-01-20 23:53:08 +01:00
2679f5fa56 Allow random selection for ProxyExercise 2023-01-20 21:02:20 +01:00
fcc6d69982 Fix percentage value display for remote score 2023-01-12 18:50:50 +01:00
87771b905a Fix rubocop offenses 2023-01-11 23:57:29 +01:00
6a942ccf50 Capture exception for Scoring
Previously, an exception was caused by the tubesock gem but not sent to Sentry. This caused errors not to bubble up correctly but rather kill the current thread, leaving the user with a generic "WebSocket connection not established" message.

Probably, this should be removed when updating the WebSocket implementation.
2022-12-23 13:04:34 +01:00
7cd61acbce I18n: Automatically choose locale through HTTP header 2022-12-20 10:26:32 +01:00
8a6e0a8366 Catch empty files_json during conversion 2022-12-19 16:11:35 +01:00
17356c3045 Allow redirect to main CodeOcean host
When a file cannot be retrieved any longer, we send a redirect to the previous locations. As we usually enable a different render host, Rails sees this redirect as a redirect to another host (from the render host to the main CodeOcean host).
2022-12-19 16:06:47 +01:00
bec235c8d6 Fix XML parsing with invalid LTI response
An invalid XML response may be returned if the LTI provider is unavailable and cannot handle our request. We decided against logging in Sentry as this affects a third party functionality we cannot fix ourselves.
Fixes CODEOCEAN-G2
2022-12-07 23:00:21 +01:00
bc5baed05e Use exec_query for custom SQL execution
Also align how we use query Postgres from controllers.

The change is mainly due to regular (but not reproducible) issues with the `intervalstyle` defaulting to `postgres` (instead of `iso8601`) and thereby causing issues. We're just experimenting to see whether this change resolves the issue.
2022-12-06 22:41:00 +01:00
9977e1614b Allow external redirect for render host and LTI
We only use the `launch_presentation_return_url` provided to the @provider, in order to prevent using an open redirect.
2022-12-05 22:38:13 +01:00
b7a3fd4586 Refactor exercise statistics to use convert times in Ruby 2022-12-05 21:59:34 +01:00
90b30e2bf7 Upgrade to Rails 7.0 and apply new framework defaults
* Remove `send_stream` method pulled in before upgrading Rails
* Remove spring, it is no longer included by default for new apps
* Remove deprecated options from environments
* Remove old asset paths and workarounds no longer needed
* Remove unnecessary `OAUTH_10_SUPPORT` const, LTI still uses OAuth 1.0
* Dump schema with new defaults (and specify precision for timestamps where needed)
2022-12-04 15:21:59 +01:00
574e99eddd Fix rubocop offenses - Requires Ruby 3.1+ 2022-11-25 11:10:06 +01:00
dfbf06274c Specify class for html_escape 2022-11-24 17:16:18 +01:00
ab688e09c0 Execute SQL statement in ping controller 2022-11-21 14:52:11 +01:00
25707478ea Require user for Community Solution
Fixes CODEOCEAN-F7
2022-11-21 10:48:08 +01:00
b6cecf53aa Pundit: Skip authorization in case of errors
Fixes CODEOCEAN-F3
2022-11-17 21:37:45 +01:00
b2af4e0663 Check submission and exercise files when filtering downloads 2022-11-17 20:47:33 +01:00
591f776f69 Close WebSocket connection normally
With Tubesock, we need to send a close frame ourselves. Otherwise, some browsers might display a warning.
2022-11-16 23:16:49 +01:00