Skip to content

Commit 42c84cb

Browse files
authored
Merge pull request #3 from ddanilyuk/fix/groupParser
Fix chron, update parser
2 parents 71abe9c + b94ef19 commit 42c84cb

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

Sources/App/Cron/RefreshGroupsCron.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public struct RefreshGroupsCron: AsyncVaporCronSchedulable {
1313
public typealias T = Void
1414

1515
public static var expression: String {
16-
"0 4 * * 1,4"
16+
"0 4 * * 0"
1717
}
1818

1919
public static func task(on application: Application) async throws -> Void {

Sources/KPIHubParser/GroupParser.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ public struct GroupParser: Parser {
2020

2121
public func parse(_ input: inout String) throws -> [Group] {
2222

23+
let linkParser = Parse {
24+
Skip { PrefixThrough("ViewSchedule.aspx?g=") }
25+
PrefixUpTo("\"").map { UUID(uuidString: String($0)) }
26+
}
2327
let singleIdParser = Parse {
24-
Parse {
25-
Skip { PrefixThrough("ViewSchedule.aspx?g=") }
26-
PrefixUpTo("\"").map { UUID(uuidString: String($0)) }
27-
}
28+
linkParser
2829
Parse {
2930
"\">"
3031
PrefixUpTo("<").map { String($0) }
@@ -40,7 +41,7 @@ public struct GroupParser: Parser {
4041
let parser = Parse {
4142
OneOf {
4243
multipleIdParser
43-
singleIdParser.map { [$0] }
44+
linkParser.map { [Group(id: $0, name: groupName)] }
4445
}
4546
Skip { Rest() }
4647
}

0 commit comments

Comments
 (0)