Skip to content

Commit 94aaa43

Browse files
authored
Merge pull request #7 from dutwrapper/draft - 1.9.2
Bumped to 1.9.2
2 parents 4b82634 + b55007d commit 94aaa43

File tree

8 files changed

+58
-55
lines changed

8 files changed

+58
-55
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
This file will list all version log for modified, add or remove function of dutwrapper.
44

5+
## 1.9.2
6+
- Fixed cannot login account using this library.
7+
- Sv.dut.udn.vn seems to reboot server again, so __VIEWSTATE changed again.
8+
9+
## 1.9.1
10+
- Fixed issue cause SubjectCodeItem parses failed (by change all variables to string).
11+
- Fixed issue cause AccountTrainingStatus parses wrong data.
12+
513
## 1.9.0
614
- Move all HttpClientWrapper to project root (customrequest2 to HttpClientWrapper).
715
- Fixed issues causes Account class not working.

CREDIT.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

README.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
# DutWrapper
22

3-
This library provides wrapper (for this repository - crawl data from a page) for access for some features in [DUT Student page - Da Nang University of Technology](http://sv.dut.udn.vn).
4-
5-
## Building requirements
3+
An unofficial wrapper for easier to use at [sv.dut.udn.vn - Da Nang University of Technology student page](http://sv.dut.udn.vn).
64

5+
# Building requirements
76
- JDK (tested with Eclipse Temurin JDK with Hotspot v17.0.2 and v8).
8-
- [Jsoup](https://jsoup.org/) (included in library)
9-
- [OkHttp3](https://square.github.io/okhttp/) (included in library)
10-
11-
## License and credits
127

13-
- [MIT](LICENSE) (click to view licenses)
14-
- [Click here](CREDIT.md) for view which this repository used.
8+
# FAQ
159

16-
## FAQ
10+
## Where can I found library changelog?
11+
If you want to:
12+
- View major changes: [Click here](CHANGELOG.md).
13+
- View entire source code changes: [Click here](https://github.com/dutwrapper/dutwrapper-java/commits).
14+
- You will need to change branch if you want to view changelog for stable/draft version.
1715

18-
### Branch in dutwrapper?
16+
## Branch in dutwrapper?
1917
- `stable`/`main`: Default branch and main release.
2018
- `draft`: Alpha branch. This branch is used for update my progress and it's very unstable. Use it at your own risk.
2119

22-
### I received error about login while running AccountTest?
20+
## I received error about login while running AccountTest?
2321
- Did you mean this error: `dut_account environment variable not found. Please, add or modify this environment in format "username|password"`?
2422
- If so, you will need to add environment variable named `dut_account` with syntax `studentid|password`.
2523

26-
### Wiki, or manual for how-to-use?
24+
## Wiki, or manual for how-to-use?
2725
- In a plan, please be patient.
2826

29-
### Latest change log?
30-
- To view log for all versions, [click here](CHANGELOG.md).
31-
32-
## Copyright?
33-
- This project - dutwrapper - is not affiliated with [Da Nang University of Technology](http://sv.dut.udn.vn).
34-
- DUT, Da Nang University of Technology, web materials and web contents are trademarks and copyrights of [Da Nang University of Technology](http://sv.dut.udn.vn) school.
27+
## I'm got issue with this library. Which place can I reproduce issue for you?
28+
- If you found a issue, you can report this via [issue tab](https://github.com/dutwrapper/dutwrapper-java/issues) on this repository.
29+
30+
# Credit and license?
31+
- License: [**MIT**](LICENSE)
32+
- DISCLAIMER:
33+
- This project - dutwrapper - is not affiliated with [Da Nang University of Technology](http://sv.dut.udn.vn).
34+
- DUT, Da Nang University of Technology, web materials and web contents are trademarks and copyrights of [Da Nang University of Technology](http://sv.dut.udn.vn) school.
35+
- Used third-party dependencies:
36+
- [Jsoup](https://github.com/jhy/jsoup): Licensed under the [MIT License](https://github.com/jhy/jsoup/blob/master/LICENSE).
37+
- [OkHttp3](https://github.com/square/okhttp): Licensed under the [Apache License 2.0](https://github.com/square/okhttp/blob/master/LICENSE.txt).
38+
- [Gson](https://github.com/google/gson): Licensed under the [Apache License 2.0](https://github.com/google/gson/blob/master/LICENSE).

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'io.dutwrapper.dutwrapper'
6-
version '1.9.0'
6+
version '1.9.2'
77

88
repositories {
99
mavenCentral()

src/main/java/io/dutwrapper/dutwrapper/Account.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public Double cellToDoubleOrNull(Element element) {
8585
}
8686
try {
8787
return Double.parseDouble(data);
88-
} catch (Exception _) {
88+
} catch (Exception ex) {
8989
return null;
9090
}
9191
}
@@ -99,7 +99,7 @@ public Integer cellToIntegerOrNull(Element element) {
9999
}
100100
try {
101101
return Integer.parseInt(data);
102-
} catch (Exception _) {
102+
} catch (Exception ex) {
103103
return null;
104104
}
105105
}
@@ -587,7 +587,8 @@ public static AccountTrainingStatus getAccountTrainingStatus(String sessionId) t
587587
utils.cellToDoubleOrNull(cellList.get(13)),
588588
utils.cellToDoubleOrNull(cellList.get(14)),
589589
utils.cellToDoubleOrNull(cellList.get(15)),
590-
cellList.get(16).text(),
590+
utils.cellToDoubleOrNull(cellList.get(16)),
591+
cellList.get(17).text(),
591592
accSubjectResult.stream().anyMatch(p -> p.getName() == cellList.get(4).text()));
592593

593594
accSubjectResult.add(item);

src/main/java/io/dutwrapper/dutwrapper/Variables.java

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/main/java/io/dutwrapper/dutwrapper/model/accounts/SubjectCodeItem.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
// Details in http://daotao.dut.udn.vn/download2/Guide_Dangkyhoc.pdf, page 28
77
public class SubjectCodeItem implements Serializable {
88
// Area 1
9-
private Integer subjectId = 0;
9+
private String subjectId = "";
1010
// Area 2
11-
private Integer schoolYearId = 0;
11+
private String schoolYearId = "";
1212
// Area 3
1313
private String studentYearId = "";
1414
// Area 4
@@ -23,7 +23,7 @@ public SubjectCodeItem(String studentYearId, String classId) {
2323
this.classId = classId;
2424
}
2525

26-
public SubjectCodeItem(Integer subjectId, Integer schoolYearId, String studentYearId, String classId) {
26+
public SubjectCodeItem(String subjectId, String schoolYearId, String studentYearId, String classId) {
2727
this.subjectId = subjectId;
2828
this.schoolYearId = schoolYearId;
2929
this.studentYearId = studentYearId;
@@ -32,8 +32,8 @@ public SubjectCodeItem(Integer subjectId, Integer schoolYearId, String studentYe
3232

3333
public SubjectCodeItem(String input) {
3434
if (input.split("\\.").length == 4) {
35-
this.subjectId = Integer.parseInt(input.split("\\.")[0]);
36-
this.schoolYearId = Integer.parseInt(input.split("\\.")[1]);
35+
this.subjectId = input.split("\\.")[0];
36+
this.schoolYearId = input.split("\\.")[1];
3737
this.studentYearId = input.split("\\.")[2];
3838
this.classId = input.split("\\.")[3];
3939
} else if (input.split("\\.").length == 2) {
@@ -42,19 +42,19 @@ public SubjectCodeItem(String input) {
4242
}
4343
}
4444

45-
public Integer getSubjectId() {
45+
public String getSubjectId() {
4646
return subjectId;
4747
}
4848

49-
public void setSubjectId(Integer subjectId) {
49+
public void setSubjectId(String subjectId) {
5050
this.subjectId = subjectId;
5151
}
5252

53-
public Integer getSchoolYearId() {
53+
public String getSchoolYearId() {
5454
return schoolYearId;
5555
}
5656

57-
public void setSchoolYearId(Integer schoolYearId) {
57+
public void setSchoolYearId(String schoolYearId) {
5858
this.schoolYearId = schoolYearId;
5959
}
6060

@@ -83,7 +83,7 @@ public String toString(Boolean twoLastDigit) {
8383
if (twoLastDigit)
8484
return String.format("%s.%s", studentYearId, classId);
8585
else
86-
return String.format("%02d.%02d.%s.%s", subjectId, schoolYearId, studentYearId, classId);
86+
return String.format("%s.%s.%s.%s", subjectId, schoolYearId, studentYearId, classId);
8787
}
8888

8989
public Boolean equalsTwoDigits(SubjectCodeItem codeItem) {

src/main/java/io/dutwrapper/dutwrapper/model/accounts/trainingresult/SubjectResult.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class SubjectResult {
1212
@Nullable
1313
String pointFormula;
1414
@Nullable
15-
Double pointBT, pointBV, pointCC, pointCK, pointGK, pointQT, pointTH;
15+
Double pointBT, pointBV, pointCC, pointCK, pointGK, pointQT, pointTH, pointTT;
1616
@Nullable
1717
Double resultT4, resultT10;
1818
@Nullable
@@ -24,7 +24,7 @@ public SubjectResult() {
2424

2525
public SubjectResult(Integer index, String schoolYear, Boolean isExtendedSemester, String id, String name,
2626
Double credit, String pointFormula, Double pointBT, Double pointBV, Double pointCC, Double pointCK,
27-
Double pointGK, Double pointQT, Double pointTH, Double resultT10, Double resultT4, String resultByCharacter,
27+
Double pointGK, Double pointQT, Double pointTH, Double pointTT, Double resultT10, Double resultT4, String resultByCharacter,
2828
Boolean isReStudy) {
2929
this.index = index;
3030
this.schoolYear = schoolYear;
@@ -40,6 +40,7 @@ public SubjectResult(Integer index, String schoolYear, Boolean isExtendedSemeste
4040
this.pointGK = pointGK;
4141
this.pointQT = pointQT;
4242
this.pointTH = pointTH;
43+
this.pointTT = pointTT;
4344
this.resultT4 = resultT4;
4445
this.resultT10 = resultT10;
4546
this.resultByCharacter = resultByCharacter;
@@ -158,6 +159,14 @@ public void setPointTH(Double pointTH) {
158159
this.pointTH = pointTH;
159160
}
160161

162+
public @Nullable Double getPointTT() {
163+
return pointTT;
164+
}
165+
166+
public void setPointTT(Double pointTT) {
167+
this.pointTT = pointTT;
168+
}
169+
161170
public @Nullable Double getResultT4() {
162171
return resultT4;
163172
}

0 commit comments

Comments
 (0)