Fix: Post voucher was not working. Replace command had borked the url.

Fix: Attendace report file name contained single quotes and did not open in excel
This commit is contained in:
2020-12-08 12:59:26 +05:30
parent 1f21438a4c
commit ccf2f704b6
13 changed files with 31 additions and 12 deletions

View File

@ -41,7 +41,7 @@ def get_report(
output, output,
db, db,
) )
headers = {"Content-Disposition": "attachment; filename = 'attendance-record.csv'"} headers = {"Content-Disposition": "attachment; filename = attendance-record.csv"}
output.seek(0) output.seek(0)
return StreamingResponse(output, media_type="text/csv", headers=headers) return StreamingResponse(output, media_type="text/csv", headers=headers)
finally: finally:

View File

@ -37,6 +37,13 @@
"style": "camelCase" "style": "camelCase"
} }
], ],
"@typescript-eslint/lines-between-class-members": [
"error",
"always",
{
"exceptAfterSingleLine": true
}
],
"import/order": [ "import/order": [
"error", "error",
{ {
@ -46,6 +53,9 @@
], ],
"@typescript-eslint/naming-convention": [ "@typescript-eslint/naming-convention": [
"off" "off"
],
"@typescript-eslint/no-explicit-any": [
"error"
] ]
} }
}, },

View File

@ -19,7 +19,7 @@ export class AttendanceService {
return this.http return this.http
.get<Attendance>(getUrl) .get<Attendance>(getUrl)
.pipe( .pipe(
catchError(this.log.handleError(serviceName, `get date as Observable<Attendance>=${date}`)), catchError(this.log.handleError(serviceName, `get date=${date}`)),
) as Observable<Attendance>; ) as Observable<Attendance>;
} }

View File

@ -20,7 +20,7 @@ export class ClientService {
const getUrl: string = id === null ? url : `${url}/${id}`; const getUrl: string = id === null ? url : `${url}/${id}`;
return this.http return this.http
.get<Client>(getUrl) .get<Client>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id as Observable<Client>=${id}`))) as Observable<Client>; .pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<Client>;
} }
list(): Observable<Client[]> { list(): Observable<Client[]> {

View File

@ -18,7 +18,7 @@ export class AccountService {
const getUrl: string = id === null ? `${url}` : `${url}/${id}`; const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
return this.http return this.http
.get<Account>(getUrl) .get<Account>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id as Observable<Account>=${id}`))) as Observable<Account>; .pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<Account>;
} }
list(): Observable<Account[]> { list(): Observable<Account[]> {

View File

@ -60,7 +60,7 @@ export class VoucherService {
post(id: string): Observable<Voucher> { post(id: string): Observable<Voucher> {
return this.http return this.http
.post<Voucher>(`${url}/post as Observable<Voucher>-voucher/${id}`, {}) .post<Voucher>(`${url}/post-voucher/${id}`, {})
.pipe(catchError(this.log.handleError(serviceName, 'Post Voucher'))) as Observable<Voucher>; .pipe(catchError(this.log.handleError(serviceName, 'Post Voucher'))) as Observable<Voucher>;
} }

View File

@ -20,7 +20,7 @@ export class CostCentreService {
return this.http return this.http
.get<CostCentre>(getUrl) .get<CostCentre>(getUrl)
.pipe( .pipe(
catchError(this.log.handleError(serviceName, `get id as Observable<CostCentre>=${id}`)), catchError(this.log.handleError(serviceName, `get id=${id}`)),
) as Observable<CostCentre>; ) as Observable<CostCentre>;
} }

View File

@ -31,7 +31,7 @@ export class EmployeeAttendanceService {
.get<EmployeeAttendance>(getUrl, options) .get<EmployeeAttendance>(getUrl, options)
.pipe( .pipe(
catchError( catchError(
this.log.handleError(serviceName, `get id as Observable<EmployeeAttendance>=${id}`), this.log.handleError(serviceName, `get id=${id}`),
), ),
) as Observable<EmployeeAttendance>; ) as Observable<EmployeeAttendance>;
} }

View File

@ -18,7 +18,7 @@ export class EmployeeService {
const getUrl: string = id === null ? `${url}` : `${url}/${id}`; const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
return this.http return this.http
.get<Employee>(getUrl) .get<Employee>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id as Observable<Employee>=${id}`))) as Observable<Employee>; .pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<Employee>;
} }
list(): Observable<Employee[]> { list(): Observable<Employee[]> {

View File

@ -20,7 +20,7 @@ export class ProductGroupService {
return this.http return this.http
.get<ProductGroup>(getUrl) .get<ProductGroup>(getUrl)
.pipe( .pipe(
catchError(this.log.handleError(serviceName, `get id as Observable<ProductGroup>=${id}`)), catchError(this.log.handleError(serviceName, `get id=${id}`)),
) as Observable<ProductGroup>; ) as Observable<ProductGroup>;
} }

View File

@ -17,7 +17,7 @@ export class ProductService {
const getUrl: string = id === null ? `${url}` : `${url}/${id}`; const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
return this.http return this.http
.get<Product>(getUrl) .get<Product>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id as Observable<Product>=${id}`))) as Observable<Product>; .pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<Product>;
} }
list(): Observable<Product[]> { list(): Observable<Product[]> {

View File

@ -20,7 +20,7 @@ export class RoleService {
const getUrl: string = id === null ? `${url}` : `${url}/${id}`; const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
return this.http return this.http
.get<Role>(getUrl) .get<Role>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id as Observable<Role>=${id}`))) as Observable<Role>; .pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<Role>;
} }
list(): Observable<Role[]> { list(): Observable<Role[]> {

View File

@ -7,7 +7,16 @@ import {
platformBrowserDynamicTesting, platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'; } from '@angular/platform-browser-dynamic/testing';
declare const require: any; declare const require: {
context(
path: string,
deep?: boolean,
filter?: RegExp,
): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment. // First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());