Skip to content
Snippets Groups Projects

feat: converting docx with pictures to moodle xml single choice questions #10

Merged klamas requested to merge feature/10 into main

Created by: AnneliKlamas

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 1 ## To run:
2 Requires Java 17
2
3 Requires Java 21
4
3 5 Run QuizConverterApplication
6
4 7 Runs on port 8000
8
9 ## About the project:
10
11 This project is a simple quiz converter that takes a DOCX file and converts it to a Moodle XML format.
  • Author Owner

    Created by: TobiasReiter

    Later also converts DOCX file to Coursera docx

  • Author Owner

    Created by: AnneliKlamas

    I decided to keep the readme up to date with how things work at the moment not how they will work. So when I add new functionality then I will update it accordingly.

  • klamas
    klamas @klamas started a thread on commit 991793f0
  • 1 package com.quiz.converter.handlers;
    2
    3 import com.quiz.converter.models.enums.ParagraphType;
    4 import com.quiz.converter.models.QuestionState;
    5
    6 import java.util.Optional;
    7
    8 public class FeedbackHandler {
    9 private final QuestionState state;
    10
    11 public FeedbackHandler(QuestionState state) {
    12 this.state = state;
    13 }
    14
    15 public void add(String text, ParagraphType paragraphType) {
    • Author Owner

      Created by: TobiasReiter

      Maybe replacing if conditions with switch improves code readability

  • klamas
    klamas @klamas started a thread on commit 991793f0
  • 1 package com.quiz.converter.handlers;
    2
    3 import com.quiz.converter.models.enums.ParagraphType;
    4 import com.quiz.converter.models.QuestionState;
    5
    6 import java.util.Optional;
    7
    8 public class FeedbackHandler {
    9 private final QuestionState state;
    10
    11 public FeedbackHandler(QuestionState state) {
    12 this.state = state;
    13 }
    14
    15 public void add(String text, ParagraphType paragraphType) {
    • Author Owner

      Created by: TobiasReiter

      Error handling, example when paragraphType does not match with value.

    • Author Owner

      Created by: AnneliKlamas

      If the value is not DEFAULT_FEEDBACK nor FEEDBACK then this method shouldn't be used.

  • klamas
    klamas @klamas started a thread on commit 991793f0
  • 7 import com.quiz.converter.models.QuestionDescription;
    8 import com.quiz.converter.models.QuestionState;
    9 import com.quiz.converter.models.enums.ParagraphType;
    10 import org.apache.poi.xwpf.usermodel.XWPFDocument;
    11 import org.apache.poi.xwpf.usermodel.XWPFParagraph;
    12 import org.springframework.stereotype.Service;
    13 import org.springframework.web.multipart.MultipartFile;
    14
    15 import java.io.IOException;
    16 import java.util.ArrayList;
    17 import java.util.Base64;
    18 import java.util.List;
    19
    20 @Service
    21 public class FileUploadService {
    22 public List<Question> convertDocToQuestion(MultipartFile file) throws IOException {
    • Author Owner

      Created by: TobiasReiter

      using switch statement can improve readability

    • Author Owner

      Created by: TobiasReiter

      example:

      switch (paragraphType) { case EMPTY_TEXT: handleEmptyTextParagraph(paragraphPictures, state); break; case QUESTION_DETAILS: ....

  • klamas changed title from #10 converting docx with pictures to moodle xml single choice questions to feat: converting docx with pictures to moodle xml single choice questions #10

    changed title from #10 converting docx with pictures to moodle xml single choice questions to feat: converting docx with pictures to moodle xml single choice questions #10

  • Author Owner

    Merged by: AnneliKlamas at 2024-03-31 15:43:17 UTC

  • klamas merged manually

    merged manually

  • closed

  • Please register or sign in to reply
    Loading