Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for detecting if a grading config will work with an exercise that doesn't need exceptions #164

Open
Luro02 opened this issue Jan 16, 2025 · 0 comments

Comments

@Luro02
Copy link
Collaborator

Luro02 commented Jan 16, 2025

The use case is to choose an exercise from a list that can be used with the specified grading config.

The current solution is to parse the grading config with the provided exercise and if it throws an exception, assume it's incompatible with the given exercise.

Obviously this is suboptimal, because

  • it can not differentiate between an invalid config and one where the version is incompatible
  • every time the string has to be parsed again, resulting in unnecessary overhead
  • the code doesn't look nice

A potential solution would be to introduce an intermediate class that can later be converted to the GradingConfig type?

Maybe something like this:

public class ParsedGradingConfig {
  private final GradingConfigDTO dto;

  public boolean isSupported(Exercise exercise) {
    // ...
  }

  public GradingConfig toConfig(Exercise exercise) throws ArtemisException {
    // ...
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant