source: SMSSender/gateways/Schoolnet/src/business/deepthought/questionmanager.h @ 225:821bf75dfe7b

Last change on this file since 225:821bf75dfe7b was 225:821bf75dfe7b, checked in by Sämy Zehnder <saemy.zehnder@…>, 7 years ago

Schoolnet:

  • Not changing the eventTarget of a question anymore as it was done by the new fixing code. We are instead using temporary eventTarget variables which do not get stored in the database. This is because we are using eventTarget as part of the question identification when talking to DeepThought?.
File size: 2.5 KB
Line 
1/*
2 Schoolnet gateway plugin - The smssender plugin for the Schoolnet sms platform.
3 Copyright (C) 2007-2012, gorrión. See http://smssender.gorrion.ch
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef QUESTIONMANAGER_H_
20#define QUESTIONMANAGER_H_
21
22#include <QObject>
23
24#include <smacros.h>
25
26#include "datatypes.h"
27
28namespace Schoolnet {
29
30class BCAccount;
31
32class Answer;
33class ProposedAnswer;
34
35class QuestionManager : public QObject {
36    Q_OBJECT
37    S_SINGLETON(QuestionManager)
38
39public:
40    QList<Question>   questions();
41    QList<Question>   openQuestions(BCAccount* account, const QStringList& acceptedLanguages);
42
43    void              pushQuestionBack(const Question& question);
44    void              saveQuestion(Question question);
45    void              deleteQuestion(Question question);
46
47    bool              isStatusAtSchoolnetChecked(BCAccount *account, const Question &question) const;
48    QSet<BCAccount *> getAccountsWhereQuestionStatusAtSchoolnetChecked(const Question &question) const;
49    void              setStatusAtSchoolnetChecked(BCAccount *account, const Question &question) const;
50    bool              isQuestionUnansweredAtSomeAccount(const Question &question) const;
51    QSet<BCAccount *> getAccountsWhereQuestionUnanswered(const Question &question) const;
52    bool              isQuestionAnsweredAtSchoolnet(BCAccount* account, const Question& question) const;
53    void              setQuestionAnsweredAtSchoolnet(BCAccount* account, const Question& question) const;
54
55    void              provideAnswerCorrectness(Answer answer, bool correct);
56
57    QString           getAdjustedEventTarget(const Question &question, const QString &html);
58
59signals:
60    void              answerCorrectnessProvided(const Answer& answer);
61
62private:
63    void              appendQuestion(const Question& question);
64    void              appendQuestions(const QList<Question>& questions);
65
66private:
67    bool questionListInitialized_;
68    QList<Question> questions_;
69};
70
71}
72
73#endif /* QUESTIONMANAGER_H_ */
Note: See TracBrowser for help on using the repository browser.